Currently, the constructors for AST nodes accept arbitrary keyword arguments and don't enforce any value:
>>> node=ast.FunctionDef(what="is this")
>>> node.what
'is this'
>>> node.name
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'FunctionDef' object has no attribute 'name'
Currently, the constructors for AST nodes accept arbitrary keyword arguments and don't enforce any value:
Problems with the current situation:
namebeing present__match_args__attributes of AST nodes #104799)Proposed solution for 3.13:
whatabove). In 3.15, this will raise an error.__text_signature__to the AST classes indicating the expected signature.Linked PRs