Skip to content

Support Python 3.10+ changes to the AST #93

@Technologicat

Description

@Technologicat

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: type statement (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: lazify and autocurry should not recurse into ast.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 TryStar as well as Try.
    • Not much detects Try; just autoreturn and scopeanalyzer.
  • DONE in faab516: Anything that detects binding forms needs to detect captures in match/case.
    • It seems unpythonic/syntax/scopeanalyzer.py is the only such part. But this is used in the let constructs (including do) as well as in lazify, so fixing that should be enough.
    • Bindings from the type statement are handled automatically by the old machinery, because they are names in Store context.

Anything else I'm missing?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions