Skip to content

Commit

Permalink
test long_dealloc as well
Browse files Browse the repository at this point in the history
  • Loading branch information
eendebakpt committed Dec 23, 2024
1 parent b0992cd commit d89aa25
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Objects/longobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -3646,18 +3646,18 @@ _PyLong_ExactDealloc(PyObject *self)
static void
long_dealloc(PyObject *self)
{
#ifndef Py_GIL_DISABLED
if (_long_is_small_int(self)) {
/* 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.
*
* See PEP 683, section Accidental De-Immortalizing for details
*/
printf("rare event: dealloc of small int\n");
exit(1);
_Py_SetImmortal(self);
return;
}
#endif
if (PyLong_CheckExact(self) && _PyLong_IsCompact((PyLongObject *)self)) {
_Py_FREELIST_FREE(ints, self, PyObject_Free);
return;
Expand Down

0 comments on commit d89aa25

Please sign in to comment.