Skip to content

Commit

Permalink
check setting immortal in the free-threading build
Browse files Browse the repository at this point in the history
  • Loading branch information
eendebakpt committed Dec 23, 2024
1 parent b66a4ad commit 15023d5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Objects/longobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -3653,7 +3653,10 @@ long_dealloc(PyObject *self)
{
assert(self);
if (_PyLong_IsCompact((PyLongObject *)self)) {
if (compact_int_is_small(self)) {

// test what happens if we do hit the "never should get called": we should expect memory leaks, but no crashes
int dotest = 1;
if (compact_int_is_small(self) || dotest) {
/* This should never get called, but we also don't want to SEGV if
* we accidentally decref small Ints out of existence. Instead,
* since small Ints are immortal, re-set the reference count.
Expand Down

0 comments on commit 15023d5

Please sign in to comment.