Skip to content

Conversation

@donBarbos
Copy link
Contributor

I believe that this change brings more clarity to code, and sys.version_info checks no longer use magic numbers (magic versions). Refinement of versions will help maintain some versions (maybe not necessarily by policy, but still nothing costs), otherwise we could get ImportError/AttributeError/"undefined behavior"

I just checked comment PRs according to 'Release Schedule' PEPs for 3.10, 3.11, 3.12, 3.13, 3.14 versions

Comment on lines 173 to 174
# Breakpoint: https://github.com/python/cpython/pull/27342
if sys.version_info >= (3, 10, 0, "candidate"):
Copy link
Member

Choose a reason for hiding this comment

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

I like the comments you're adding to link to the CPython PRs, but I'd leave the sys.version_info conditions as they are unless we know of an actual problem that needs to be fixed here. This kind of change has caused significant breakage for users in the past in ways that were hard for us to anticipate ahead of time; it doesn't seem worth it to me to change anything here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, but I’m not quite sure what kind of breakages could occur in this case, especially for sys.version_info checks before importing attributes. I’m having trouble imagining how this change might cause issues. Could you elaborate or give an example?

Copy link
Member

Choose a reason for hiding this comment

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

Sure, sorry for being vague! In #145, for example, I made it so that typing_extensions.Literal was no longer the same object as typing.Literal on Python <=3.9.0 (previously it had been the same object as typing.Literal on all Python versions >=3.8). Pydantic had internal code that incorrectly assumed that typing_extensions.Literal would always be the same object as typing.Literal on Python 3.8+, so this broke pydantic, causing a lot of disruption across the ecosystem and meaning we had to do a hotfix release of typing_extensions:

I don't think it's very likely that the specific changes you proposed here would cause that kind of breakage! But over the years of maintaining typing_extensions, I've come to realise that you really can't predict what kind of assumptions people are making about things like this -- I had no idea that change would break pydantic! So it's better not to make changes like this unless they're actually fixing something :-)

@donBarbos donBarbos changed the title Refine version_info checks Add breakpoint comments to version_info checks Aug 10, 2025
@AlexWaygood AlexWaygood merged commit 5312ff7 into python:main Aug 10, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants