Open
Description
Feature or enhancement
Proposal:
Currently all of these are allowed:
>>> import ast
>>> ast.expr()
<ast.expr object at 0x10526cce0>
>>> ast.stmt()
<ast.stmt object at 0x1054508d0>
>>> ast.AST()
<ast.AST object at 0x105229610>
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
Links to previous discussion of this feature:
https://discuss.python.org/t/proposed-change-to-ast-node-constructors/46531/4