Commit 1cdfcfc9 authored by Victor Stinner's avatar Victor Stinner Committed by GitHub

bpo-35337: Fix gettmarg(): use PyStructSequence_GET_ITEM() (GH-10765)

PyStructSequence_GET_ITEM() must be used instead of
PyTuple_GET_ITEM() on a StructTimeType.
parent 54ba556c
...@@ -568,7 +568,7 @@ gettmarg(PyObject *args, struct tm *p, const char *format) ...@@ -568,7 +568,7 @@ gettmarg(PyObject *args, struct tm *p, const char *format)
#ifdef HAVE_STRUCT_TM_TM_ZONE #ifdef HAVE_STRUCT_TM_TM_ZONE
if (Py_TYPE(args) == &StructTimeType) { if (Py_TYPE(args) == &StructTimeType) {
PyObject *item; PyObject *item;
item = PyTuple_GET_ITEM(args, 9); item = PyStructSequence_GET_ITEM(args, 9);
if (item != Py_None) { if (item != Py_None) {
p->tm_zone = (char *)PyUnicode_AsUTF8(item); p->tm_zone = (char *)PyUnicode_AsUTF8(item);
if (p->tm_zone == NULL) { if (p->tm_zone == NULL) {
...@@ -589,7 +589,7 @@ gettmarg(PyObject *args, struct tm *p, const char *format) ...@@ -589,7 +589,7 @@ gettmarg(PyObject *args, struct tm *p, const char *format)
} }
#endif #endif
} }
item = PyTuple_GET_ITEM(args, 10); item = PyStructSequence_GET_ITEM(args, 10);
if (item != Py_None) { if (item != Py_None) {
p->tm_gmtoff = PyLong_AsLong(item); p->tm_gmtoff = PyLong_AsLong(item);
if (PyErr_Occurred()) if (PyErr_Occurred())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment