-
Notifications
You must be signed in to change notification settings - Fork 199
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
Handle module.__file__ == None #1042
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,7 +148,11 @@ def is_stdlib_name(modname): | |
return False | ||
|
||
# six installs crap with no __file__ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment is now more mislaeading than helpful, please remove it. |
||
modpath = os.path.abspath(getattr(module, '__file__', '')) | ||
path = getattr(module, '__file__', '') | ||
if path is None: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like to have an accompanying unit test for this case. If you'd like to add one I recommend doing so in Otherwise I'm happy to add one. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding the package might be tricky, since it seems to be a part of Python distribution, though I'm not 100% sure. Will try to reproduce on different environments There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
So I recommend you use a small There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I see, thanks for clarification 👍 |
||
path = '' | ||
|
||
modpath = os.path.abspath(path) | ||
return is_stdlib_path(modpath) | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is more misleading than helpful. Better to remove it.