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

Prevents reaching inner blocks that contains if TYPE_CHECKING #211

Merged
merged 3 commits into from
Jan 18, 2022

Conversation

thepabloaguilar
Copy link
Contributor

Hi, thanks for your work on this plugin! We're having some problems with returns because we use type guards inside some classes like here which leads in some warnings while building sphinx broking our builds:

WARNING: Failed guarded type import with AttributeError('__globals__')

This PR fixes that issue, basically when a class object doesn't have the __globals__ attribute so we basically can call exec without the globals if the given object doesn't have the mentioned attribute.

Copy link
Member

@gaborbernat gaborbernat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a changelog entry too, thanks!

@thepabloaguilar thepabloaguilar changed the title Fixes typing guard inside classes Prevents reaching inner blocks that contains if TYPE_CHECKING Jan 18, 2022
Copy link
Member

@gaborbernat gaborbernat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just add a changelog entry and we're good 👍

CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Member

@gaborbernat gaborbernat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gaborbernat gaborbernat merged commit 3492d49 into tox-dev:main Jan 18, 2022
@gaborbernat
Copy link
Member

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