diff options
Diffstat (limited to 'Objects/codeobject.c')
-rw-r--r-- | Objects/codeobject.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Objects/codeobject.c b/Objects/codeobject.c index e9ac209a95f..ee869d991d9 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -1959,13 +1959,9 @@ int _PyCode_CheckNoInternalState(PyCodeObject *co, const char **p_errmsg) { const char *errmsg = NULL; - if (_PyCode_HAS_EXECUTORS(co) || _PyCode_HAS_INSTRUMENTATION(co)) { - errmsg = "only basic code objects are supported"; - } - else if (co->_co_monitoring != NULL) { - errmsg = "only basic code objects are supported"; - } - else if (co->co_extra != NULL) { + // We don't worry about co_executors, co_instrumentation, + // or co_monitoring. They are essentially ephemeral. + if (co->co_extra != NULL) { errmsg = "only basic code objects are supported"; } @@ -2368,6 +2364,8 @@ free_monitoring_data(_PyCoMonitoringData *data) static void code_dealloc(PyObject *self) { + PyThreadState *tstate = PyThreadState_GET(); + _Py_atomic_add_uint64(&tstate->interp->_code_object_generation, 1); PyCodeObject *co = _PyCodeObject_CAST(self); _PyObject_ResurrectStart(self); notify_code_watchers(PY_CODE_EVENT_DESTROY, co); |