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

Prefer import to __import__ #82

Merged
merged 2 commits into from Nov 23, 2022

Conversation

zwimer
Copy link
Contributor

@zwimer zwimer commented Nov 23, 2022

What

In __init__.py there is a loop that invokes __import__ here:

def _init_externals():

Since the loop only has one item this PR convert refactors it to use the standard import.

Why

Some tooling only works with modules to be imported via import as the packages names are resolve-able without executing code, which __import__ prevents.

Possible Changes

If it is desired to have smmap added into globals() of __init__.py; I can remove the del smmap line. Right now it is there because __import__, which import is replacing, does not add smmap to globals()

@Byron
Copy link
Member

Byron commented Nov 23, 2022

Thanks a lot, this change is much appreciated. It's clear that this kind of __import__ logic isn't very useful here anymore, after all it's just a single module to import.

@Byron Byron merged commit 43de984 into gitpython-developers:master Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants