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

Fix __module__ default when run in an exec #210

Merged
merged 3 commits into from
Nov 27, 2021

Conversation

andyljones
Copy link
Contributor

Running typeguard 2.13 in an exec with an empty environment errors. This PR fixes that by mapping a f.__module__ of None to the empty string.

exec("""
from typeguard import typechecked

@typechecked
def f():
   pass

""", {})

(The root issue is that this exec-in-empty-namespace thing is what doctests like to do)

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.8%) to 85.281% when pulling 8e86f41 on andyljones:exec-fix into 8cfbe29 on agronholm:master.

@agronholm agronholm merged commit 580826d into agronholm:master Nov 27, 2021
@agronholm
Copy link
Owner

Thanks!

agronholm added a commit that referenced this pull request Nov 27, 2021
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.

3 participants