Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix deprecated ast classes - #13285

Merged
JelleZijlstra merged 2 commits into
python:mainfrom
tungol:ast
Dec 28, 2024
Merged

fix deprecated ast classes#13285
JelleZijlstra merged 2 commits into
python:mainfrom
tungol:ast

Conversation

@tungol

@tungol tungol commented Dec 23, 2024

Copy link
Copy Markdown
Contributor

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.

@github-actions

This comment has been minimized.

Comment thread stdlib/ast.pyi
@@ -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
Copy Markdown
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
Copy Markdown
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.

@github-actions

Copy link
Copy Markdown
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