diff options
author | Victor Stinner <vstinner@python.org> | 2020-04-14 13:14:01 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-14 13:14:01 (GMT) |
commit | 81a7be3fa22c983209cc0ffb3537b92b0370f83c (patch) | |
tree | c257d7143ecc60574353caa76fa2992a455ebb54 /Objects/codeobject.c | |
parent | 4a3fe0835310643193ea45529ab0fb45c5f8f2fd (diff) | |
download | cpython-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 'Objects/codeobject.c')
-rw-r--r-- | Objects/codeobject.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/codeobject.c b/Objects/codeobject.c index 7cb72ce..da04af4 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -6,7 +6,7 @@ #include "structmember.h" #include "pycore_code.h" #include "pycore_interp.h" // PyInterpreterState.co_extra_freefuncs -#include "pycore_pystate.h" // _PyInterpreterState_GET_UNSAFE() +#include "pycore_pystate.h" // _PyInterpreterState_GET() #include "pycore_tupleobject.h" #include "clinic/codeobject.c.h" @@ -555,7 +555,7 @@ code_dealloc(PyCodeObject *co) co->co_opcache_size = 0; if (co->co_extra != NULL) { - PyInterpreterState *interp = _PyInterpreterState_GET_UNSAFE(); + PyInterpreterState *interp = _PyInterpreterState_GET(); _PyCodeObjectExtra *co_extra = co->co_extra; for (Py_ssize_t i = 0; i < co_extra->ce_size; i++) { @@ -1074,7 +1074,7 @@ _PyCode_GetExtra(PyObject *code, Py_ssize_t index, void **extra) int _PyCode_SetExtra(PyObject *code, Py_ssize_t index, void *extra) { - PyInterpreterState *interp = _PyInterpreterState_GET_UNSAFE(); + PyInterpreterState *interp = _PyInterpreterState_GET(); if (!PyCode_Check(code) || index < 0 || index >= interp->co_extra_user_count) { |