8000 test small int test · python/cpython@3a553d1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3a553d1

Browse files
committed
test small int test
1 parent b4c8444 commit 3a553d1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Objects/longobject.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3642,7 +3642,11 @@ _PyLong_ExactDealloc(PyObject *self)
36423642
static void
36433643
long_dealloc(PyObject *self)
36443644
{
3645-
if (_long_is_small_int(self)) {
3645+
// 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) {
36463650
/* This should never get called, but we also don't want to SEGV if
36473651
* we accidentally decref small Ints out of existence. Instead,
36483652
* since small Ints are immortal, re-set the reference count.

0 commit comments

Comments
 (0)
0