summaryrefslogtreecommitdiff
path: root/Modules/_datetimemodule.c
diff options
context:
space:
mode:
authorPaul Ganssle <pganssle@users.noreply.github.com>2018-01-24 17:29:30 -0500
committerAlexander Belopolsky <abalkin@users.noreply.github.com>2018-01-24 17:29:30 -0500
commit04af5b1ba9eb546a29735fac6cb5298159069b53 (patch)
tree12e50adcc6ee03a3a4a80cb0a9b37bff4b58901b /Modules/_datetimemodule.c
parentccbe5818af20f8c12043f5c30c277a74714405e0 (diff)
downloadcpython-git-04af5b1ba9eb546a29735fac6cb5298159069b53.tar.gz
bpo-10381: Add timezone to datetime C API (#5032)
* Add timezone to datetime C API * Add documentation for timezone C API macros * Add dedicated tests for datetime type check macros * Remove superfluous C API test * Drop support for TimeZoneType in datetime C API * Expose UTC singleton to the datetime C API * Update datetime C-API documentation to include links * Add reference count information for timezone constructors
Diffstat (limited to 'Modules/_datetimemodule.c')
-rw-r--r--Modules/_datetimemodule.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c
index d1f48e5bd0..4a33f2d896 100644
--- a/Modules/_datetimemodule.c
+++ b/Modules/_datetimemodule.c
@@ -6036,10 +6036,12 @@ static PyDateTime_CAPI CAPI = {
&PyDateTime_TimeType,
&PyDateTime_DeltaType,
&PyDateTime_TZInfoType,
+ NULL, // PyDatetime_TimeZone_UTC not initialized yet
new_date_ex,
new_datetime_ex,
new_time_ex,
new_delta_ex,
+ new_timezone,
datetime_fromtimestamp,
date_fromtimestamp,
new_datetime_ex2,
@@ -6168,6 +6170,7 @@ PyInit__datetime(void)
if (x == NULL || PyDict_SetItemString(d, "utc", x) < 0)
return NULL;
PyDateTime_TimeZone_UTC = x;
+ CAPI.TimeZone_UTC = PyDateTime_TimeZone_UTC;
delta = new_delta(-1, 60, 0, 1); /* -23:59 */
if (delta == NULL)