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

Failure to compile nested module level comprehension #1906

Closed
scoder opened this issue Oct 3, 2017 · 0 comments
Closed

Failure to compile nested module level comprehension #1906

scoder opened this issue Oct 3, 2017 · 0 comments
Assignees
Milestone

Comments

@scoder
Copy link
Contributor

scoder commented Oct 3, 2017

This dict comprehension from CPython's sre_compile.py fails to compile in 0.27.1 (and earlier):

_equivalences = (
    (0x69, 0x131), # iı
    (0x345, 0x3b9, 0x1fbe), # \u0345ιι
    # ...
)
_ignorecase_fixes = {
    i: tuple(j for j in t if i != j)
    for t in _equivalences for i in t
}

The errors occur in the inner tuple(genexpr):

local variable 't' referenced before assignment
local variable 'i' referenced before assignment

This is because the loop variables are handled, but not analysed, as globals.

@scoder scoder self-assigned this Oct 3, 2017
@scoder scoder closed this as completed in 53a3e9a Oct 3, 2017
@scoder scoder added this to the 0.27.2 milestone Oct 3, 2017
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