Flow graph optimizer has more information and can do better job.
eclips4@nixos ~/p/p/cpython (remove-ast-optimizer)> ./python example.py
File "/home/eclips4/programming/programming-languages/cpython/example.py", line 4
case -0:
^^
SyntaxError: patterns may only match literals and attribute lookups
Feature or enhancement
Proposal:
For additional context see #126830 (comment).
Flow graph optimizer has more information and can do better job.
The problem is that we need to convert from
UNARY_OP(-, CONST(1))toCONST(-1), still before the code generation phase, because this leads to a few problems, one of which is shown below.cc @markshannon
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
optimize_if_const_subscrrefleaks #129634test_peepholer.py::TestTranforms#131826