]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
closes bpo-39736: const strings in Modules/_datetimemodule.c and Modules/_testbuffer...
authorAndy Lester <andy@petdance.com>
Mon, 24 Feb 2020 06:40:43 +0000 (00:40 -0600)
committerGitHub <noreply@github.com>
Mon, 24 Feb 2020 06:40:43 +0000 (22:40 -0800)
Modules/_datetimemodule.c
Modules/_testbuffer.c

index 4cafd1401255883a70adf4abb9d25d43958518cc..4c985b37385e827dbc306c1a5027941474d16531 100644 (file)
@@ -4179,11 +4179,11 @@ static PyObject *
 time_isoformat(PyDateTime_Time *self, PyObject *args, PyObject *kw)
 {
     char buf[100];
-    char *timespec = NULL;
+    const char *timespec = NULL;
     static char *keywords[] = {"timespec", NULL};
     PyObject *result;
     int us = TIME_GET_MICROSECOND(self);
-    static char *specs[][2] = {
+    static const char *specs[][2] = {
         {"hours", "%02d"},
         {"minutes", "%02d:%02d"},
         {"seconds", "%02d:%02d:%02d"},
@@ -5415,7 +5415,7 @@ datetime_isoformat(PyDateTime_DateTime *self, PyObject *args, PyObject *kw)
     char buffer[100];
     PyObject *result = NULL;
     int us = DATE_GET_MICROSECOND(self);
-    static char *specs[][2] = {
+    static const char *specs[][2] = {
         {"hours", "%04d-%02d-%02d%c%02d"},
         {"minutes", "%04d-%02d-%02d%c%02d:%02d"},
         {"seconds", "%04d-%02d-%02d%c%02d:%02d:%02d"},
index f4c2b590ac9c324461a803e5ff82da54b40035fc..d8321768bc9729cea99b88a0947082500140fbee 100644 (file)
@@ -2050,7 +2050,7 @@ static PyObject *
 ndarray_get_format(NDArrayObject *self, void *closure)
 {
     Py_buffer *base = &self->head->base;
-    char *fmt = base->format ? base->format : "";
+    const char *fmt = base->format ? base->format : "";
     return PyUnicode_FromString(fmt);
 }