Skip to content

Commit 6e67695

Browse files
authored
timemodule.c: Cast PyUnicode_AsUTF8() to char* (python#1294)
bpo-28769 changed PyUnicode_AsUTF8() return type from const char* to char* in Python 3.7, but tm_zone field type of the tm structure is char* on FreeBSD. Cast PyUnicode_AsUTF8() to char* in gettmarg() to fix the warning: Modules/timemodule.c:443:20: warning: assigning to 'char *' from 'const char *' discards qualifiers
1 parent 87c07fe commit 6e67695

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Modules/timemodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ gettmarg(PyObject *args, struct tm *p)
440440
if (Py_TYPE(args) == &StructTimeType) {
441441
PyObject *item;
442442
item = PyTuple_GET_ITEM(args, 9);
443-
p->tm_zone = item == Py_None ? NULL : PyUnicode_AsUTF8(item);
443+
p->tm_zone = item == Py_None ? NULL : (char*)PyUnicode_AsUTF8(item);
444444
item = PyTuple_GET_ITEM(args, 10);
445445
p->tm_gmtoff = item == Py_None ? 0 : PyLong_AsLong(item);
446446
if (PyErr_Occurred())

0 commit comments

Comments
 (0)