Skip to content

Commit 15023d5

Browse files
committed
check setting immortal in the free-threading build
1 parent b66a4ad commit 15023d5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Objects/longobject.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3653,7 +3653,10 @@ long_dealloc(PyObject *self)
36533653
{
36543654
assert(self);
36553655
if (_PyLong_IsCompact((PyLongObject *)self)) {
3656-
if (compact_int_is_small(self)) {
3656+
3657+
// test what happens if we do hit the "never should get called": we should expect memory leaks, but no crashes
3658+
int dotest = 1;
3659+
if (compact_int_is_small(self) || dotest) {
36573660
/* This should never get called, but we also don't want to SEGV if
36583661
* we accidentally decref small Ints out of existence. Instead,
36593662
* since small Ints are immortal, re-set the reference count.

0 commit comments

Comments
 (0)