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 /Modules/_threadmodule.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 'Modules/_threadmodule.c')
-rw-r--r-- | Modules/_threadmodule.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c index 69e27be..f6b39de 100644 --- a/Modules/_threadmodule.c +++ b/Modules/_threadmodule.c @@ -1049,7 +1049,7 @@ thread_PyThread_start_new_thread(PyObject *self, PyObject *fargs) boot = PyMem_NEW(struct bootstate, 1); if (boot == NULL) return PyErr_NoMemory(); - boot->interp = PyThreadState_GET()->interp; + boot->interp = _PyInterpreterState_Get(); boot->func = func; boot->args = args; boot->keyw = keyw; @@ -1154,8 +1154,8 @@ A thread's identity may be reused for another thread after it exits."); static PyObject * thread__count(PyObject *self, PyObject *Py_UNUSED(ignored)) { - PyThreadState *tstate = PyThreadState_Get(); - return PyLong_FromLong(tstate->interp->num_threads); + PyInterpreterState *interp = _PyInterpreterState_Get(); + return PyLong_FromLong(interp->num_threads); } PyDoc_STRVAR(_count_doc, @@ -1348,7 +1348,7 @@ PyInit__thread(void) PyObject *m, *d, *v; double time_max; double timeout_max; - PyThreadState *tstate = PyThreadState_Get(); + PyInterpreterState *interp = _PyInterpreterState_Get(); /* Initialize types: */ if (PyType_Ready(&localdummytype) < 0) @@ -1395,7 +1395,7 @@ PyInit__thread(void) if (PyModule_AddObject(m, "_local", (PyObject *)&localtype) < 0) return NULL; - tstate->interp->num_threads = 0; + interp->num_threads = 0; str_dict = PyUnicode_InternFromString("__dict__"); if (str_dict == NULL) |