unpythonic
unpythonic copied to clipboard
Support Python 3.10+ changes to the AST
There have been some recent changes to the Python AST:
- Python 3.10:
match/case(pattern matching, now a native Python feature) - Python 3.11:
try/except*(exception groups) - Python 3.12:
typestatement (type alias)
Full details in official docs.
Question is, what do we need to change in unpythonic to support these? At least:
-
DONE in 58388fc:
lazifyandautocurryshould not recurse intoast.TypeAlias, because lazifying or autocurrying a type declaration makes no sense. -
DONE in 040e333: Anything that touches on exception handling in the macro layer needs to detect
TryStaras well asTry.- Not much detects
Try; justautoreturnand scopeanalyzer.
- Not much detects
-
DONE in faab516: Anything that detects binding forms needs to detect captures in
match/case.- It seems
unpythonic/syntax/scopeanalyzer.pyis the only such part. But this is used in theletconstructs (includingdo) as well as inlazify, so fixing that should be enough. - Bindings from the
typestatement are handled automatically by the old machinery, because they are names inStorecontext.
- It seems
Anything else I'm missing?
Since the parts I'm aware of are now done, but there may still be something I've missed, I'm keeping this ticket open, but moving it to the 0.15.4 milestone.