Skip to content

Commit

Permalink
GH-94851: check refcnt of immortal objects after finalization (GH-95001)
Browse files Browse the repository at this point in the history
  • Loading branch information
kumaraditya303 authored Jul 25, 2022
1 parent ac6a94c commit 73ee5a6
Show file tree
Hide file tree
Showing 4 changed files with 4,430 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Include/internal/pycore_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ extern "C" {
#include "pycore_pystate.h" // _PyInterpreterState_GET()
#include "pycore_runtime.h" // _PyRuntime

/* This value provides *effective* immortality, meaning the object should never
be deallocated (until runtime finalization). See PEP 683 for more details about
immortality, as well as a proposed mechanism for proper immortality. */
#define _PyObject_IMMORTAL_REFCNT 999999999

#define _PyObject_IMMORTAL_INIT(type) \
{ \
.ob_refcnt = 999999999, \
.ob_refcnt = _PyObject_IMMORTAL_REFCNT, \
.ob_type = (type), \
}
#define _PyVarObject_IMMORTAL_INIT(type, size) \
Expand Down
Loading

0 comments on commit 73ee5a6

Please sign in to comment.