summaryrefslogtreecommitdiffstats
path: root/Modules/_threadmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-04-14 13:14:01 (GMT)
committerGitHub <noreply@github.com>2020-04-14 13:14:01 (GMT)
commit81a7be3fa22c983209cc0ffb3537b92b0370f83c (patch)
treec257d7143ecc60574353caa76fa2992a455ebb54 /Modules/_threadmodule.c
parent4a3fe0835310643193ea45529ab0fb45c5f8f2fd (diff)
downloadcpython-81a7be3fa22c983209cc0ffb3537b92b0370f83c.zip
cpython-81a7be3fa22c983209cc0ffb3537b92b0370f83c.tar.gz
cpython-81a7be3fa22c983209cc0ffb3537b92b0370f83c.tar.bz2
bpo-40268: Rename _PyInterpreterState_GET_UNSAFE() (GH-19509)
Rename _PyInterpreterState_GET_UNSAFE() to _PyInterpreterState_GET() for consistency with _PyThreadState_GET() and to have a shorter name (help to fit into 80 columns). Add also "assert(tstate != NULL);" to the function.
Diffstat (limited to 'Modules/_threadmodule.c')
-rw-r--r--Modules/_threadmodule.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
index 9853699..5636140 100644
--- a/Modules/_threadmodule.c
+++ b/Modules/_threadmodule.c
@@ -1091,7 +1091,7 @@ thread_PyThread_start_new_thread(PyObject *self, PyObject *fargs)
boot = PyMem_NEW(struct bootstate, 1);
if (boot == NULL)
return PyErr_NoMemory();
- boot->interp = _PyInterpreterState_GET_UNSAFE();
+ boot->interp = _PyInterpreterState_GET();
boot->func = func;
boot->args = args;
boot->keyw = keyw;
@@ -1213,7 +1213,7 @@ particular thread within a system.");
static PyObject *
thread__count(PyObject *self, PyObject *Py_UNUSED(ignored))
{
- PyInterpreterState *interp = _PyInterpreterState_GET_UNSAFE();
+ PyInterpreterState *interp = _PyInterpreterState_GET();
return PyLong_FromLong(interp->num_threads);
}
@@ -1556,7 +1556,7 @@ PyInit__thread(void)
PyObject *m, *d, *v;
double time_max;
double timeout_max;
- PyInterpreterState *interp = _PyInterpreterState_GET_UNSAFE();
+ PyInterpreterState *interp = _PyInterpreterState_GET();
/* Initialize types: */
if (PyType_Ready(&localdummytype) < 0)