Skip to content

GH-127705: Revert "Move mortal decrefs to internal header and make sure _PyReftracerTrack is called" - #131500

Closed
encukou wants to merge 1 commit into
python:mainfrom
encukou:revert-fd545d7
Closed

encukou wants to merge 1 commit into
python:mainfrom
encukou:revert-fd545d7

Conversation

@encukou

@encukou encukou commented Mar 20, 2025 •

Copy link
Copy Markdown
Member

This reverts commit fd545d7,
which broke Py_TRACE_REFS builds.

…ake sure _PyReftracerTrack is called"

This broke Py_TRACE_REFS builds.
This reverts commit fd545d7.
@colesbury

Copy link
Copy Markdown
Contributor

This is easy to fix. _Py_Dealloc() is responsible for _Py_ForgetReference() so we only should include it manually if we're not going to call _Py_Dealloc().

diff --git a/Include/internal/pycore_object.h b/Include/internal/pycore_object.h
index 08cbfe46b0d..30b88404bbe 100644
--- a/Include/internal/pycore_object.h
+++ b/Include/internal/pycore_object.h
@@ -445,9 +445,6 @@ static inline void Py_DECREF_MORTAL(const char *filename, int lineno, PyObject *
         _Py_DECREF_DecRefTotal();
     }
     if (--op->ob_refcnt == 0) {
-#ifdef Py_TRACE_REFS
-        _Py_ForgetReference(op);
-#endif
         _Py_Dealloc(op);
     }
 }
@markshannon

Copy link
Copy Markdown
Member

Thanks Sam

#131508

@vstinner

Copy link
Copy Markdown
Member

Issue fixed by 684a759, this revert is no longer needed.

@vstinner vstinner closed this Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

4 participants