summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2024-05-28 00:52:52 (GMT)
committerGitHub <noreply@github.com>2024-05-28 00:52:52 (GMT)
commit9216a5336fc3c5b594bba1ae18779100c207b23f (patch)
tree3039c437812900ea63167597c375fa0cb268f15c /Modules
parent7322ff15614fb3f25eae565f00f9beaf62f71314 (diff)
downloadcpython-9216a5336fc3c5b594bba1ae18779100c207b23f.zip
cpython-9216a5336fc3c5b594bba1ae18779100c207b23f.tar.gz
cpython-9216a5336fc3c5b594bba1ae18779100c207b23f.tar.bz2
[3.13] gh-117398: Revert gh-119636, Add multiphase support to _datetime (#119639)
Revert "[3.13] gh-117398: Add multiphase support to _datetime (gh-119373) (gh-119636)" This reverts commit d58ebf073c755c2f0f6e4ef2296b48a4c75e5f1c.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_datetimemodule.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c
index 3ff8a2c..8164715 100644
--- a/Modules/_datetimemodule.c
+++ b/Modules/_datetimemodule.c
@@ -6970,26 +6970,30 @@ error:
}
#undef DATETIME_ADD_MACRO
-static PyModuleDef_Slot module_slots[] = {
- {Py_mod_exec, _datetime_exec},
- {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
- {Py_mod_gil, Py_MOD_GIL_NOT_USED},
- {0, NULL},
-};
-
-static PyModuleDef datetimemodule = {
+static struct PyModuleDef datetimemodule = {
.m_base = PyModuleDef_HEAD_INIT,
.m_name = "_datetime",
.m_doc = "Fast implementation of the datetime type.",
- .m_size = 0,
+ .m_size = -1,
.m_methods = module_methods,
- .m_slots = module_slots,
};
PyMODINIT_FUNC
PyInit__datetime(void)
{
- return PyModuleDef_Init(&datetimemodule);
+ PyObject *mod = PyModule_Create(&datetimemodule);
+ if (mod == NULL)
+ return NULL;
+#ifdef Py_GIL_DISABLED
+ PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
+#endif
+
+ if (_datetime_exec(mod) < 0) {
+ Py_DECREF(mod);
+ return NULL;
+ }
+
+ return mod;
}
/* ---------------------------------------------------------------------------