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 nested lazy import and sys meta path modification issue #62

Merged
merged 3 commits into from
Aug 2, 2022

Conversation

gkumbhat
Copy link
Member

@gkumbhat gkumbhat commented Aug 2, 2022

Changes

  • Fix case when sys.meta_path is modified (appended) by some other library. This issue was noticed when sys.meta_path was getting modified by setuptools.command.build_py.
  • Fix case when a library implementing lazy import errors (by using import-tracker) was getting used by another library implementing lazy import errors (nested lazy import error case)

Copy link
Collaborator

@gabe-l-hart gabe-l-hart left a comment

Choose a reason for hiding this comment

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

Thanks @gkumbhat! There are two cleanup steps to get the tests to pass:

  • make fmt
  • git fetch origin && git rebase --signoff origin/main

Copy link
Collaborator

@gabe-l-hart gabe-l-hart left a comment

Choose a reason for hiding this comment

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

One more little cleanup

sys.meta_path.pop()
if self.finder in sys.meta_path:
sys.meta_path.remove(self.finder)
# while sys.meta_path and isinstance(sys.meta_path[-1], _LazyErrorMetaFinder):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove these dead lines

Copy link
Collaborator

@gabe-l-hart gabe-l-hart left a comment

Choose a reason for hiding this comment

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

Looks great. Nice improvement!

@gabe-l-hart gabe-l-hart merged commit 572d0ab into IBM:main Aug 2, 2022
@gkumbhat gkumbhat deleted the fix_nested_lazy_import branch August 2, 2022 15:23
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