Skip to content

Conversation

@bedevere-app bedevere-app bot added docs Documentation in the Doc dir skip news labels Dec 4, 2025
@github-project-automation github-project-automation bot moved this to Todo in Docs PRs Dec 4, 2025
@colesbury colesbury changed the title gh-12324: Document restrictions for tp_traverse implementations gh-123241: Document restrictions for tp_traverse implementations Dec 4, 2025
@colesbury colesbury marked this pull request as ready for review December 4, 2025 21:49
Copy link
Contributor

@mpage mpage left a comment

Choose a reason for hiding this comment

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

LGTM

@encukou
Copy link
Member

encukou commented Dec 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.
I assume there can't be a period of deprecation warnings. Does this need a PEP 387 exception?

@pablogsal
Copy link
Member

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.

I assume there can't be a period of deprecation warnings. Does this need a PEP 387 exception?

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
Copy link
Contributor

DinoV commented Dec 5, 2025

Arguably the "create or destroy" objects is redundant given that involves modifying a reference count but LGTM.

@colesbury colesbury merged commit 37988c5 into python:main Dec 8, 2025
34 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Docs PRs Dec 8, 2025
@colesbury colesbury deleted the gh-123241-docs branch December 8, 2025 17:22
@colesbury colesbury added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Dec 8, 2025
@miss-islington-app
Copy link

Thanks @colesbury for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks @colesbury for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 8, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 8, 2025
@bedevere-app
Copy link

bedevere-app bot commented Dec 8, 2025

GH-142422 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Dec 8, 2025
@bedevere-app
Copy link

bedevere-app bot commented Dec 8, 2025

GH-142423 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Dec 8, 2025
colesbury added a commit that referenced this pull request Dec 8, 2025
…ions (gh-142272) (#142423)

(cherry picked from commit 37988c5)

Co-authored-by: Sam Gross <[email protected]>
colesbury added a commit that referenced this pull request Dec 8, 2025
…ions (gh-142272) (#142422)

(cherry picked from commit 37988c5)

Co-authored-by: Sam Gross <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants