diff options
author | Victor Stinner <vstinner@redhat.com> | 2018-08-03 13:33:52 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-03 13:33:52 (GMT) |
commit | caba55b3b735405b280273f7d99866a046c18281 (patch) | |
tree | 3a98ac383b1fbab272158933255fb1a14107ebf6 /Objects/moduleobject.c | |
parent | 2ebd3813af9172fe1f9b2f6004edf6f1e1e5d9f1 (diff) | |
download | cpython-caba55b3b735405b280273f7d99866a046c18281.zip cpython-caba55b3b735405b280273f7d99866a046c18281.tar.gz cpython-caba55b3b735405b280273f7d99866a046c18281.tar.bz2 |
bpo-34301: Add _PyInterpreterState_Get() helper function (GH-8592)
sys_setcheckinterval() now uses a local variable to parse arguments,
before writing into interp->check_interval.
Diffstat (limited to 'Objects/moduleobject.c')
-rw-r--r-- | Objects/moduleobject.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c index 5fad447..2156ca0 100644 --- a/Objects/moduleobject.c +++ b/Objects/moduleobject.c @@ -173,7 +173,7 @@ _add_methods_to_object(PyObject *module, PyObject *name, PyMethodDef *functions) PyObject * PyModule_Create2(struct PyModuleDef* module, int module_api_version) { - if (!_PyImport_IsInitialized(PyThreadState_GET()->interp)) + if (!_PyImport_IsInitialized(_PyInterpreterState_Get())) Py_FatalError("Python import machinery not initialized"); return _PyModule_CreateInitialized(module, module_api_version); } @@ -693,8 +693,7 @@ module_dealloc(PyModuleObject *m) static PyObject * module_repr(PyModuleObject *m) { - PyThreadState *tstate = PyThreadState_GET(); - PyInterpreterState *interp = tstate->interp; + PyInterpreterState *interp = _PyInterpreterState_Get(); return PyObject_CallMethod(interp->importlib, "_module_repr", "O", m); } |