-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Fix regression with empty package names #4115
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
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 |
---|---|---|
|
@@ -651,7 +651,7 @@ def visit_Import(self, n: ast3.Import) -> Import: | |
def visit_ImportFrom(self, n: ast3.ImportFrom) -> ImportBase: | ||
assert n.level is not None | ||
if len(n.names) == 1 and n.names[0].name == '*': | ||
assert n.module is not None | ||
assert n.module is not '' | ||
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 is actually not what I meant. The fix should at least replace 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.
Is this what you mean? 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. Yes, but it may be more subtle than that. 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. OK, it looks like you can write mod = n.module if n.module is not None else ''
i = ImportAll(mod, n.level) Also please make the corresponding change in (I think this is something we should get into the next release, so it is better not to wait with this.) 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. @matzipan Is there any progress on this? It is a crash so I don't want the fix to wait indefinitely. 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. My new pipeline is failing on this, fix would be really appreciated. |
||
i = ImportAll(n.module, n.level) # type: ImportBase | ||
else: | ||
i = ImportFrom(self.translate_module_id(n.module) if n.module is not None else '', | ||
|
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.
Are you sure
is not ''
is the right thing to do? I'd expectn.module != ''
.