Skip to content

gh-119562: Remove AST nodes deprecated since Python 3.8 #119563

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

Merged
merged 4 commits into from
May 26, 2024

Conversation

AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented May 25, 2024

@AlexWaygood AlexWaygood requested a review from hugovk May 25, 2024 19:50
@@ -508,27 +508,6 @@ def generic_visit(self, node):
elif isinstance(value, AST):
self.visit(value)

def visit_Constant(self, node):
Copy link
Contributor

@AraHaan AraHaan May 26, 2024

Choose a reason for hiding this comment

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

Uh I think you accidentally removed this. Above said to use this. 😄

Copy link
Member Author

@AlexWaygood AlexWaygood May 26, 2024

Choose a reason for hiding this comment

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

I deliberately removed it. It will still work if you define visit_Constant on a custom subclass of ast.NodeVisitor. The reason why it is currently defined on ast.NodeVisitor itself — uniquely among the visit_* methods — is to ensure that the deprecated methods visit_Num, visit_Str, etc. continue to work if you define them on a subclass of ast.NodeVisitor.

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried to clarify this a bit in 40b5965 -- hopefully that helps!

@AlexWaygood AlexWaygood enabled auto-merge (squash) May 26, 2024 12:09
@AlexWaygood AlexWaygood merged commit 008bc04 into python:main May 26, 2024
33 checks passed
@AlexWaygood AlexWaygood deleted the ast-removals branch May 26, 2024 12:34
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
luk1337 added a commit to luk1337/weechat that referenced this pull request Oct 30, 2024
luk1337 added a commit to luk1337/weechat that referenced this pull request Oct 30, 2024
flashcode pushed a commit to weechat/weechat that referenced this pull request Nov 4, 2024
flashcode pushed a commit to weechat/weechat that referenced this pull request Nov 4, 2024
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.

Remove AST nodes deprecated since Python 3.8, with warnings since Python 3.12
3 participants