Adding these two lines to /Objects/longobject.c will disable the "preallocated small integer pool":
#define NSMALLPOSINTS 0
#define NSMALLNEGINTS 0
Then run this reproduce code (attached):
from enum import IntEnum
import _signal
class Handlers(IntEnum):
A = _signal.SIG_DFL
B = _signal.SIG_IGN
When the interpreter exits, will get this error:
d:\dev\cpython\PCbuild\win32>python_d.exe d:\a.py
d:\dev\cpython\include\object.h:541: _Py_NegativeRefcount: Assertion failed: object has negative ref count
<object: freed>
Fatal Python error: _PyObject_AssertFailed
Current thread 0x0000200c (most recent call first):
3.8 and 3.9 branches are affected.
I'm sorry, this issue is beyond my ability. |