@@ -2293,6 +2293,29 @@ make_timezones_capi(PyObject *self, PyObject *args) {
2293
2293
return rv ;
2294
2294
}
2295
2295
2296
+ static PyObject *
2297
+ get_timezones_offset_zero (PyObject * self , PyObject * args ) {
2298
+ PyObject * offset = PyDelta_FromDSU (0 , 0 , 0 );
2299
+ PyObject * name = PyUnicode_FromString ("" );
2300
+
2301
+ // These two should return the UTC singleton
2302
+ PyObject * utc_singleton_0 = PyTimeZone_FromOffset (offset );
2303
+ PyObject * utc_singleton_1 = PyTimeZone_FromOffsetAndName (offset , NULL );
2304
+
2305
+ // This one will return +00:00 zone, but not the UTC singleton
2306
+ PyObject * non_utc_zone = PyTimeZone_FromOffsetAndName (offset , name );
2307
+
2308
+ Py_DecRef (offset );
2309
+ Py_DecRef (name );
2310
+
2311
+ PyObject * rv = PyTuple_New (3 );
2312
+ PyTuple_SET_ITEM (rv , 0 , utc_singleton_0 );
2313
+ PyTuple_SET_ITEM (rv , 1 , utc_singleton_1 );
2314
+ PyTuple_SET_ITEM (rv , 2 , non_utc_zone );
2315
+
2316
+ return rv ;
2317
+ }
2318
+
2296
2319
static PyObject *
2297
2320
get_timezone_utc_capi (PyObject * self , PyObject * args ) {
2298
2321
int macro = 0 ;
@@ -4540,6 +4563,7 @@ static PyMethodDef TestMethods[] = {
4540
4563
{"datetime_check_delta" , datetime_check_delta , METH_VARARGS },
4541
4564
{"datetime_check_tzinfo" , datetime_check_tzinfo , METH_VARARGS },
4542
4565
{"make_timezones_capi" , make_timezones_capi , METH_NOARGS },
4566
+ {"get_timezones_offset_zero" , get_timezones_offset_zero , METH_NOARGS },
4543
4567
{"get_timezone_utc_capi" , get_timezone_utc_capi , METH_VARARGS },
4544
4568
{"test_list_api" , (PyCFunction )test_list_api , METH_NOARGS },
4545
4569
{"test_dict_iteration" , (PyCFunction )test_dict_iteration ,METH_NOARGS },
0 commit comments