[Python-checkins] closes bpo-39736: const strings in Modules/_datetimemodule.c and Modules/_testbuffer.c (GH-18637)
Andy Lester
webhook-mailer at python.org
Mon Feb 24 01:40:56 EST 2020
https://github.com/python/cpython/commit/c3fa634096eedbaf477698adab666f03085a7928
commit: c3fa634096eedbaf477698adab666f03085a7928
branch: master
author: Andy Lester <andy at petdance.com>
committer: GitHub <noreply at github.com>
date: 2020-02-23T22:40:43-08:00
summary:
closes bpo-39736: const strings in Modules/_datetimemodule.c and Modules/_testbuffer.c (GH-18637)
files:
M Modules/_datetimemodule.c
M Modules/_testbuffer.c
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c
index 4cafd14012558..4c985b37385e8 100644
--- a/Modules/_datetimemodule.c
+++ b/Modules/_datetimemodule.c
@@ -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"},
diff --git a/Modules/_testbuffer.c b/Modules/_testbuffer.c
index f4c2b590ac9c3..d8321768bc972 100644
--- a/Modules/_testbuffer.c
+++ b/Modules/_testbuffer.c
@@ -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);
}
More information about the Python-checkins
mailing list