Skip to content

gh-156371: Fix missing PyRefTracer_DESTROY events for trashcan objects - #156372

Open
corona10 wants to merge 6 commits into
python:mainfrom
corona10:gh-156371
Open

gh-156371: Fix missing PyRefTracer_DESTROY events for trashcan objects#156372
corona10 wants to merge 6 commits into
python:mainfrom
corona10:gh-156371

Conversation

@corona10

@corona10 corona10 commented Aug 25, 2026

Copy link
Copy Markdown
Member

@corona10

Copy link
Copy Markdown
Member Author

cc @markshannon

@corona10

Copy link
Copy Markdown
Member Author

cc @vstinner and @iritkatriel who reviewed #132280 :)

@corona10

Copy link
Copy Markdown
Member Author

I've also added the test code for preventing future regression.

Comment thread Objects/object.c Outdated
#ifdef Py_TRACE_REFS
_Py_ForgetReference(op);
#endif
_PyReftracerTrack(op, PyRefTracer_DESTROY);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is right. This should be in _PyTrash_thread_destroy_chain()
The object is destroyed when the trashcan is emptied, not when the object is deposited.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, it sounds better and I've applied your suggestion.

@bedevere-app

bedevere-app Bot commented Aug 26, 2026

Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

@corona10
corona10 requested a review from markshannon August 26, 2026 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting changes needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants