We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b4c8444 commit 3a553d1Copy full SHA for 3a553d1
Objects/longobject.c
@@ -3642,7 +3642,11 @@ _PyLong_ExactDealloc(PyObject *self)
3642
static void
3643
long_dealloc(PyObject *self)
3644
{
3645
- if (_long_is_small_int(self)) {
+ // test what happens if we do hit the "never should get called": we should expect memory leaks, but no crashes
3646
+ PyLongObject *pylong = (PyLongObject *)self;
3647
+ int dotest = PyLong_CheckExact(self) && _PyLong_IsCompact(pylong) && (medium_value(pylong)==5);
3648
+
3649
+ if (_long_is_small_int(self) || dotest) {
3650
/* This should never get called, but we also don't want to SEGV if
3651
* we accidentally decref small Ints out of existence. Instead,
3652
* since small Ints are immortal, re-set the reference count.
0 commit comments