ast_opt.c imports pycore_compile.c inly for _PyASTOptimizeState, which could be defined in ast_opt.c instead.
We need to change the signature of _PyAST_Optimize to take two integers (optimization level and flags) instead of a _PyASTOptimizeState pointer. This will slightly simplify the call sites of _PyAST_Optimize, where this struct is created just to hold those two ints and pass it to _PyAST_Optimize.
Linked PRs