But these are meant to be abstract classes; constructing them is not meaningful. I propose to raise a DeprecationWarning when they are constructed and raise an error a few versions down.
(Originally suggested by Cornelius Krupp on discuss.python.)
Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
Since there are no current and planned restrictions on subclassing these abstract nodes, I have a gut feeling that deprecating this behaviour will affect code which subclass these abstract nodes and which implicitly or explicitly call the superclass constructor.
Projects which rely on AST enrichment pipelines (linters, code generators, Python-like language extensions, etc.) may rely on the current behaviour.
Activity
bzoracler commented on Feb 28, 2024
Since there are no current and planned restrictions on subclassing these abstract nodes, I have a gut feeling that deprecating this behaviour will affect code which subclass these abstract nodes and which implicitly or explicitly call the superclass constructor.
Projects which rely on AST enrichment pipelines (linters, code generators, Python-like language extensions, etc.) may rely on the current behaviour.
Merge branch 'main' into pythongh-116021-ast-depr-abstract
Merge branch 'main' into pythongh-116021-ast-depr-abstract
Merge branch 'main' into pythongh-116021-ast-depr-abstract
Merge branch 'main' into pythongh-116021-ast-depr-abstract
gh-116021: Deprecate support for instantiating abstract AST nodes (#1…