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

[mypyc] Fix using package imported inside a function #9782

Merged
merged 3 commits into from Dec 8, 2020
Merged

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Dec 6, 2020

Fix an issue where this code resulted in an unbound local p
error:

def f() -> None:
    import p.submodule
    print(p.x)  # Runtime error here

We now look up p from the global modules dictionary instead
of trying to use an undefined local variable.

This fixes an issue where this code resulted in an unbound local `p`
error:

```
def f() -> None:
    import p.submodule
    print(p.x)  # Runtime error here
```

We now look up `p` from the global modules dictionary instead
of trying to use an undefined local variable.
@JukkaL JukkaL merged commit eac1897 into master Dec 8, 2020
@JukkaL JukkaL deleted the fix-local-import branch December 8, 2020 10:48
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.

None yet

2 participants