-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Mark AST with kwargs as deprecated #13811
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -34,6 +34,12 @@ class _Attributes(TypedDict, Generic[_EndPositionT], total=False): | |||||||||||||||||||||||||||||||
# but they consider themselves to live in the ast module, | ||||||||||||||||||||||||||||||||
# so we'll define the stubs in this file. | ||||||||||||||||||||||||||||||||
class AST: | ||||||||||||||||||||||||||||||||
@overload | ||||||||||||||||||||||||||||||||
def __init__(self) -> None: ... | ||||||||||||||||||||||||||||||||
if sys.version_info < (3, 15): | ||||||||||||||||||||||||||||||||
@overload | ||||||||||||||||||||||||||||||||
@deprecated("Support for arbitrary keyword arguments is deprecated and will be removed in Python 3.15.") | ||||||||||||||||||||||||||||||||
def __init__(self, **kwargs: Any) -> None: ... | ||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't add a comment explaining this
Comment on lines
36
to
+42
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also considered the following (see #4760 (comment)):
Suggested change
|
||||||||||||||||||||||||||||||||
if sys.version_info >= (3, 10): | ||||||||||||||||||||||||||||||||
__match_args__ = () | ||||||||||||||||||||||||||||||||
_attributes: ClassVar[tuple[str, ...]] | ||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably doesn't do much in practice since nobody is constructing the base AST class. We could add this sort of overloads to every AST subclass below but I'm not sure that would make users' lives better.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, personally I wouldn't mind just closing this PR and #4760 . I mostly opened it to leave a trace when closing that issue.
But if we go for it, I'll update subclasses as well.