Skip to content
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

fix deprecated ast classes #13285

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

fix deprecated ast classes #13285

wants to merge 2 commits into from

Conversation

tungol
Copy link
Contributor

@tungol tungol commented Dec 23, 2024

The comment on these was incorrect, but there were a lot of other AST classes where that was the case. Here, they switched from an __init__ to a __new__ when they were deprecated, in order to return an instance of their replacement.

This comment has been minimized.

@@ -1186,12 +1186,18 @@ class Slice(_Slice):
) -> Self: ...

class ExtSlice(slice): # deprecated and moved to ast.py if sys.version_info >= (3, 9)
Copy link
Member

Choose a reason for hiding this comment

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

While you're here could you also @deprecated these two?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went ahead and added it for all the classes deprecated in 3.9. I didn't bother making a 3.8 branch without @deprecated since that's just one version and EOL anyway. The descriptions are all taken from the docstrings in ast.py.

Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

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.

2 participants