-
-
Notifications
You must be signed in to change notification settings - Fork 29.2k
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
gh-105858: Improve AST node constructors #105880
Merged
Merged
Commits on Jun 17, 2023
-
pythongh-105858: Improve AST node constructors
Demonstration: >>> ast.FunctionDef.__annotations__ {'name': <class 'str'>, 'args': <class 'ast.arguments'>, 'body': list[ast.stmt], 'decorator_list': list[ast.expr], 'returns': ast.expr | None, 'type_comment': str | None, 'type_params': list[ast.type_param]} >>> ast.FunctionDef() <stdin>:1: DeprecationWarning: FunctionDef.__init__ missing 1 required positional argument: 'name'. This will become an error in Python 3.15. <stdin>:1: DeprecationWarning: FunctionDef.__init__ missing 1 required positional argument: 'args'. This will become an error in Python 3.15. <ast.FunctionDef object at 0x101959460> >>> node = ast.FunctionDef(name="foo", args=ast.arguments()) >>> node.decorator_list [] >>> ast.FunctionDef(whatever="you want", name="x", args=ast.arguments()) <stdin>:1: DeprecationWarning: FunctionDef.__init__ got an unexpected keyword argument 'whatever'. Support for arbitrary keyword arguments is deprecated and will be removed in Python 3.15. <ast.FunctionDef object at 0x1019581f0> Known problems: - Subclasses of AST nodes don't work properly, because we don't look up __annotations__ on the right class. - Unpickling throws DeprecationWarnings, probably because of how we construct the unpickled object. Need to think more about how to handle those cases.
Configuration menu - View commit details
-
Copy full SHA for b1b73d9 - Browse repository at this point
Copy the full SHA b1b73d9View commit details
Commits on Jun 22, 2023
-
Configuration menu - View commit details
-
Copy full SHA for d417cf3 - Browse repository at this point
Copy the full SHA d417cf3View commit details -
Configuration menu - View commit details
-
Copy full SHA for c74740a - Browse repository at this point
Copy the full SHA c74740aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 05d5569 - Browse repository at this point
Copy the full SHA 05d5569View commit details
Commits on Oct 11, 2023
-
Configuration menu - View commit details
-
Copy full SHA for f4b14ac - Browse repository at this point
Copy the full SHA f4b14acView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0efcdf3 - Browse repository at this point
Copy the full SHA 0efcdf3View commit details -
Configuration menu - View commit details
-
Copy full SHA for f941696 - Browse repository at this point
Copy the full SHA f941696View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4c42748 - Browse repository at this point
Copy the full SHA 4c42748View commit details
Commits on Oct 24, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 1a9b872 - Browse repository at this point
Copy the full SHA 1a9b872View commit details
Commits on Feb 18, 2024
-
Configuration menu - View commit details
-
Copy full SHA for db16cc7 - Browse repository at this point
Copy the full SHA db16cc7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6bf677b - Browse repository at this point
Copy the full SHA 6bf677bView commit details -
Configuration menu - View commit details
-
Copy full SHA for a2442b6 - Browse repository at this point
Copy the full SHA a2442b6View commit details
Commits on Feb 21, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 5a1d37a - Browse repository at this point
Copy the full SHA 5a1d37aView commit details
Commits on Feb 25, 2024
-
Configuration menu - View commit details
-
Copy full SHA for c4627a1 - Browse repository at this point
Copy the full SHA c4627a1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1f85438 - Browse repository at this point
Copy the full SHA 1f85438View commit details -
Apply suggestions from code review
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Configuration menu - View commit details
-
Copy full SHA for ff0cc67 - Browse repository at this point
Copy the full SHA ff0cc67View commit details
Commits on Feb 27, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 54cf55f - Browse repository at this point
Copy the full SHA 54cf55fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4bb0656 - Browse repository at this point
Copy the full SHA 4bb0656View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.