bpo-30155: Add macros to get tzinfo from datetime instances (GH-21633)

Add PyDateTime_DATE_GET_TZINFO() and PyDateTime_TIME_GET_TZINFO()
macros.
This commit is contained in:
Zackery Spytz 2020-09-23 12:43:45 -06:00 committed by GitHub
parent 9c4eac7f02
commit 2e4dd336e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 46 additions and 17 deletions

View file

@ -2677,8 +2677,9 @@ test_PyDateTime_DATE_GET(PyObject *self, PyObject *obj)
minute = PyDateTime_DATE_GET_MINUTE(obj);
second = PyDateTime_DATE_GET_SECOND(obj);
microsecond = PyDateTime_DATE_GET_MICROSECOND(obj);
PyObject *tzinfo = PyDateTime_DATE_GET_TZINFO(obj);
return Py_BuildValue("(llll)", hour, minute, second, microsecond);
return Py_BuildValue("(llllO)", hour, minute, second, microsecond, tzinfo);
}
static PyObject *
@ -2690,8 +2691,9 @@ test_PyDateTime_TIME_GET(PyObject *self, PyObject *obj)
minute = PyDateTime_TIME_GET_MINUTE(obj);
second = PyDateTime_TIME_GET_SECOND(obj);
microsecond = PyDateTime_TIME_GET_MICROSECOND(obj);
PyObject *tzinfo = PyDateTime_TIME_GET_TZINFO(obj);
return Py_BuildValue("(llll)", hour, minute, second, microsecond);
return Py_BuildValue("(llllO)", hour, minute, second, microsecond, tzinfo);
}
static PyObject *