-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add __new__ to old ast.Constant aliases #14397
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add @deprecated marker to deprecated `Constant` attributes
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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. |
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. |
This comment has been minimized.
This comment has been minimized.
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 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
.