Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Python 3.10+ changes to the AST #93

Open
Technologicat opened this issue Sep 27, 2024 · 1 comment
Open

Support Python 3.10+ changes to the AST #93

Technologicat opened this issue Sep 27, 2024 · 1 comment
Assignees
Milestone

Comments

@Technologicat
Copy link
Owner

Technologicat commented Sep 27, 2024

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?

@Technologicat Technologicat self-assigned this Sep 27, 2024
@Technologicat Technologicat added this to the 0.15.3 milestone Sep 27, 2024
@Technologicat
Copy link
Owner Author

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.

@Technologicat Technologicat modified the milestones: 0.15.3, 0.15.4 Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant