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

Python 3.12 support: PEP-709 (inlined comprehension) #17

Merged
merged 3 commits into from
Dec 15, 2023
Merged

Conversation

wookayin
Copy link
Owner

@wookayin wookayin commented Sep 30, 2023

New syntax in python 3.12. Part of #20.

@wookayin wookayin force-pushed the py312 branch 10 times, most recently from 7956829 to 1de0760 Compare September 30, 2023 21:07
@noudin-ledger

This comment was marked as resolved.

The previous code raised an error when parsing list/set/dict
comprehensions; "IndexError: pop from empty list".

    current_table = self._table_stack.pop()  # <--- HERE

As per PEP-0709:

The symtable module will no longer produce child symbol tables for
comprehensions (but excluding generator expressions); instead, the
comprehension’s locals will be included in the parent function’s
symbol table and scope.
@wookayin wookayin changed the title feat: Add python 3.12 support Python 3.12 support: PEP-709 (inlined comprehension) Dec 6, 2023
@wookayin wookayin merged commit 0b9d164 into master Dec 15, 2023
12 checks passed
@wookayin
Copy link
Owner Author

Some follow-ups need to be done but merging for now, to make semshi work in a minimal viable manner with python3.12. Remaining: remove the assumption on the implementation details about AST syntax tree (e.g. inline comprehension is not inlined at the moment, but if it's inlined in future CPython versions it will break again).

@wookayin wookayin deleted the py312 branch October 29, 2024 13:33
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

Successfully merging this pull request may close these issues.

2 participants