Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-123241: Document restrictions fortp_traverse implementations#142272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation
tp_traverse implementationstp_traverse implementations
mpage left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM
encukou commentedDec 5, 2025
If we just add it to the docs like this, how are maintainers of old code expected to find out about it? AFAICS, this is a new requirement, and making CPython rely on it will be a breaking change. |
pablogsal commentedDec 5, 2025
This was unfortunately always a requirement for correctness but we never documented it. Calling it a "new requirement" is probably not very productive because if you were doing this before you have a bug and you can affect the correctness of the algorithm or crash depending on the version and the situation. We could perhaps raise some warnings with time time cost in debug build by checking the total ref count. |
DinoV commentedDec 5, 2025
Arguably the "create or destroy" objects is redundant given that involves modifying a reference count but LGTM. |
37988c5 intopython:mainUh oh!
There was an error while loading.Please reload this page.
Thanks@colesbury for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Thanks@colesbury for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14. |
…ons (pythongh-142272)(cherry picked from commit37988c5)Co-authored-by: Sam Gross <colesbury@gmail.com>
…ons (pythongh-142272)(cherry picked from commit37988c5)Co-authored-by: Sam Gross <colesbury@gmail.com>
GH-142422 is a backport of this pull request to the3.13 branch. |
GH-142423 is a backport of this pull request to the3.14 branch. |
Uh oh!
There was an error while loading.Please reload this page.
📚 Documentation preview 📚:https://cpython-previews--142272.org.readthedocs.build/
Py_INCREF()/Py_DECREF()intp_traversehandlers #123241