diff --git a/Objects/longobject.c b/Objects/longobject.c index 78e42617c69c5a..c9b6d3c2cfce0c 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -3649,7 +3649,9 @@ long_dealloc(PyObject *self) * * See PEP 683, section Accidental De-Immortalizing for details */ +#ifndef Py_GIL_DISABLED _Py_SetImmortal(self); +#endif return; } if (PyLong_CheckExact(self) && _PyLong_IsCompact((PyLongObject *)self)) {