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/codeobject.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/codeobject.c')
-rw-r--r-- | Objects/codeobject.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Objects/codeobject.c b/Objects/codeobject.c index b07667c..cedf11e 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -3,6 +3,7 @@ #include "Python.h" #include "code.h" #include "structmember.h" +#include "internal/pystate.h" /* Holder for co_extra information */ typedef struct { @@ -428,7 +429,7 @@ static void code_dealloc(PyCodeObject *co) { if (co->co_extra != NULL) { - PyInterpreterState *interp = PyThreadState_Get()->interp; + PyInterpreterState *interp = _PyInterpreterState_GET_UNSAFE(); _PyCodeObjectExtra *co_extra = co->co_extra; for (Py_ssize_t i = 0; i < co_extra->ce_size; i++) { @@ -871,7 +872,7 @@ _PyCode_GetExtra(PyObject *code, Py_ssize_t index, void **extra) int _PyCode_SetExtra(PyObject *code, Py_ssize_t index, void *extra) { - PyInterpreterState *interp = PyThreadState_Get()->interp; + PyInterpreterState *interp = _PyInterpreterState_GET_UNSAFE(); if (!PyCode_Check(code) || index < 0 || index >= interp->co_extra_user_count) { |