diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 14 | ||||
-rw-r--r-- | Python/pystate.c | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index bf19a5b..9109ea5 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -5608,3 +5608,17 @@ _Py_GetDXProfile(PyObject *self, PyObject *args) } #endif + +Py_ssize_t +_PyEval_RequestCodeExtraIndex(freefunc free) +{ + PyThreadState *tstate = PyThreadState_Get(); + Py_ssize_t new_index; + + if (tstate->co_extra_user_count == MAX_CO_EXTRA_USERS - 1) { + return -1; + } + new_index = tstate->co_extra_user_count++; + tstate->co_extra_freefuncs[new_index] = free; + return new_index; +} diff --git a/Python/pystate.c b/Python/pystate.c index 2ab5d5d..959354d 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -227,6 +227,7 @@ new_threadstate(PyInterpreterState *interp, int init) tstate->coroutine_wrapper = NULL; tstate->in_coroutine_wrapper = 0; + tstate->co_extra_user_count = 0; if (init) _PyThreadState_Init(tstate); |