Repository navigation
Add __new__ to old ast.Constant aliases - #14397
Merged
Merged
Conversation
Add @deprecated marker to deprecated `Constant` attributes
This comment has been minimized.
This comment has been minimized.
AlexWaygood
reviewed
Jul 11, 2025
This comment has been minimized.
This comment has been minimized.
Collaborator
Author
|
The only primer hit is (as expected) in a piece of code that won't work on Python 3.14, but can actually be simplified. |
srittau
marked this pull request as ready for review
July 11, 2025 11:39
Collaborator
Author
That said, the minimal primer fallout and the fact that these are deprecated classes, so no new code will use them, indicates that this is not a problem. |
AlexWaygood
reviewed
Jul 11, 2025
This comment has been minimized.
This comment has been minimized.
AlexWaygood
approved these changes
Jul 11, 2025
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: spack (https://github.com/spack/spack)
+ lib/spack/spack/cmd/style.py:666: error: Incompatible types in assignment (expression has type "str | bytes | int | float | complex | EllipsisType | None", variable has type "str") [assignment]
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This aligns the old constant classes closer to the actual implementation. It's not perfect, as it doesn't replicate the
__instancecheck__and doesn't replicate the fact that theoretical sub-classes of the old constant classes are still possible and don't get replaced withConstant.