1414#include "pycore_object.h" // _PyObject_Init()
1515#include "pycore_time.h" // _PyTime_ObjectToTime_t()
1616#include "pycore_unicodeobject.h" // _PyUnicode_Copy()
17+ #include "pycore_initconfig.h" // _PyStatus_OK()
1718
1819#include "datetime.h"
1920
@@ -7329,13 +7330,9 @@ clear_state(datetime_state *st)
73297330}
73307331
73317332
7332- static int
7333- init_static_types (PyInterpreterState * interp , int reloading )
7333+ PyStatus
7334+ _PyDateTime_Init (PyInterpreterState * interp )
73347335{
7335- if (reloading ) {
7336- return 0 ;
7337- }
7338-
73397336 // `&...` is not a constant expression according to a strict reading
73407337 // of C standards. Fill tp_base at run-time rather than statically.
73417338 // See https://bugs.python.org/issue40777
@@ -7347,11 +7344,11 @@ init_static_types(PyInterpreterState *interp, int reloading)
73477344 for (size_t i = 0 ; i < Py_ARRAY_LENGTH (capi_types ); i ++ ) {
73487345 PyTypeObject * type = capi_types [i ];
73497346 if (_PyStaticType_InitForExtension (interp , type ) < 0 ) {
7350- return -1 ;
7347+ return _PyStatus_ERR ( "could not initialize static types" ) ;
73517348 }
73527349 }
73537350
7354- return 0 ;
7351+ return _PyStatus_OK () ;
73557352}
73567353
73577354
@@ -7379,10 +7376,6 @@ _datetime_exec(PyObject *module)
73797376 }
73807377 /* We actually set the "current" module right before a successful return. */
73817378
7382- if (init_static_types (interp , reloading ) < 0 ) {
7383- goto error ;
7384- }
7385-
73867379 for (size_t i = 0 ; i < Py_ARRAY_LENGTH (capi_types ); i ++ ) {
73877380 PyTypeObject * type = capi_types [i ];
73887381 const char * name = _PyType_Name (type );
0 commit comments