Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Port _datetime extension module to multiphase initialization(:pep:`489`).
24 changes: 12 additions & 12 deletions Modules/_datetimemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -6694,27 +6694,27 @@ _datetime_exec(PyObject *module)
return 0;
}

static struct PyModuleDef_Slot _datetime_slots[] = {
{Py_mod_exec, _datetime_exec},
{0, NULL}
};

PyDoc_STRVAR(module_doc,
"Fast implementation of the datetime type.");

static struct PyModuleDef datetimemodule = {
PyModuleDef_HEAD_INIT,
.m_name = "_datetime",
.m_doc = "Fast implementation of the datetime type.",
.m_size = -1,
.m_doc = module_doc,
.m_size = 0,
.m_methods = module_methods,
.m_slots = _datetime_slots,
};

PyMODINIT_FUNC
PyInit__datetime(void)
{
PyObject *mod = PyModule_Create(&datetimemodule);
if (mod == NULL)
return NULL;

if (_datetime_exec(mod) < 0) {
Py_DECREF(mod);
return NULL;
}

return mod;
return PyModuleDef_Init(&datetimemodule);
}

/* ---------------------------------------------------------------------------
Expand Down