-
-
Couldn't load subscription status.
- Fork 33.3k
Closed as duplicate
Closed as duplicate
Copy link
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
Description
In Python 3.13, AST node constructors now provide defaults for the omitted fields:
- Optional fields: default to
None - List fields: default to an empty list
expr_contextfields: default toLoad()
Previously in Python 3.12 and earlier, these omitted fields would not exist as attributes, causing AttributeError when accessed.
These information can be found in What’s New In Python 3.13, but not in the ast documentation itself.
Since this is a significant behavioral change, it should be documented in the ast module documentation with a .. versionchanged:: 3.13 directive.
CPython versions tested on:
3.13
Operating systems tested on:
No response
Metadata
Metadata
Assignees
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error