mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
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
This commit is contained in:
parent
ccbe5818af
commit
04af5b1ba9
7 changed files with 329 additions and 11 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue