summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-10-05 16:34:59 (GMT)
committerGitHub <noreply@github.com>2021-10-05 16:34:59 (GMT)
commitd0d29655ffc43d426ad68542d8de8304f7f1346a (patch)
treea43da04dbe142c6c56eb5b6620855884c637fc4c /Modules
parentd0d0909a3a0b553826d1ddbb04a676fdabb61359 (diff)
downloadcpython-d0d29655ffc43d426ad68542d8de8304f7f1346a.zip
cpython-d0d29655ffc43d426ad68542d8de8304f7f1346a.tar.gz
cpython-d0d29655ffc43d426ad68542d8de8304f7f1346a.tar.bz2
bpo-44050: Extension modules can share state when they don't support sub-interpreters. (GH-27794) (GH-28738)
Automerge-Triggered-By: GH:encukou (cherry picked from commit b9bb74871b27d9226df2dd3fce9d42bda8b43c2b) Co-authored-by: Hai Shi <shihai1992@gmail.com>
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_testmultiphase.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/Modules/_testmultiphase.c b/Modules/_testmultiphase.c
index ad60f32..e0ed77d 100644
--- a/Modules/_testmultiphase.c
+++ b/Modules/_testmultiphase.c
@@ -844,6 +844,28 @@ PyInit__testmultiphase_meth_state_access(PyObject *spec)
return PyModuleDef_Init(&def_meth_state_access);
}
+static PyModuleDef def_module_state_shared = {
+ PyModuleDef_HEAD_INIT,
+ .m_name = "_test_module_state_shared",
+ .m_doc = PyDoc_STR("Regression Test module for single-phase init."),
+ .m_size = -1,
+};
+
+PyMODINIT_FUNC
+PyInit__test_module_state_shared(PyObject *spec)
+{
+ PyObject *module = PyModule_Create(&def_module_state_shared);
+ if (module == NULL) {
+ return NULL;
+ }
+
+ if (PyModule_AddObjectRef(module, "Error", PyExc_Exception) < 0) {
+ Py_DECREF(module);
+ return NULL;
+ }
+ return module;
+}
+
/*** Helper for imp test ***/