bpo-30604: clean up co_extra support (#2144)

bpo-30604: port fix from 3.6 dropping binary compatibility tweaks
This commit is contained in:
Dino Viehland 2017-06-21 14:44:36 -07:00 committed by Yury Selivanov
parent c90e960150
commit f3cffd2b78
6 changed files with 130 additions and 23 deletions

View file

@ -5287,14 +5287,14 @@ _Py_GetDXProfile(PyObject *self, PyObject *args)
Py_ssize_t
_PyEval_RequestCodeExtraIndex(freefunc free)
{
PyThreadState *tstate = PyThreadState_Get();
PyInterpreterState *interp = PyThreadState_Get()->interp;
Py_ssize_t new_index;
if (tstate->co_extra_user_count == MAX_CO_EXTRA_USERS - 1) {
if (interp->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;
new_index = interp->co_extra_user_count++;
interp->co_extra_freefuncs[new_index] = free;
return new_index;
}