-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Restore all_are_submodules
import logic as workaround for #4498
#5016
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
Conversation
The logic in build to determine what imported modules are depended on used to elide dependencies to m in `from m import a, b, c` if all of a, b, c were submodules. This was removed in #4910 because it seemed like it ought not be necessary (and that semantically there *was* a dependency), and early versions of #4910 depended removing it. The addition of this dependency, though, can cause cycles that wouldn't be there otherwise, which can cause #4498 (invalid type when using aliases in import cycles) to trip when it otherwise wouldn't. We've seen this once in a bug report and once internally, so restore the `all_are_submodules` logic in avoid triggering #4498 in these cases. Fixes #5015
Oh right, I had forgotten that to help justify removing that code I found a super obscure bug that removing it fixed. This will take marginally more thought if I don't just want to reintroduce it. |
Unfortunately the dependency on the module is actually required for correctness in some corner cases, so instead of eliding the import, we lower its priority. This causes the cycles in the regressions we are looking at to get processed in the order that works. This is obviously just a workaround.
Unfortunately the dependency on the module is actually required for This is obviously just a workaround. |
Though it looks like this fixes the #5015 bug but not the one we've observed internally. (Eliding the module when |
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.
LG, I suppose -- the web of affected bugs seems to be getting wider and wider.
The logic in build to determine what imported modules are depended on
used to elide dependencies to m in
from m import a, b, c
if all ofa, b, c were submodules. This was removed in #4910 because it seemed
like it ought not be necessary (and that semantically there was
a dependency), and early versions of #4910 depended removing it.
The addition of this dependency, though, can cause cycles that
wouldn't be there otherwise, which can cause #4498 (invalid type when
using aliases in import cycles) to trip when it otherwise wouldn't.
We've seen this once in a bug report and once internally, so restore
the
all_are_submodules
logic in avoid triggering #4498 in thesecases.
Fixes #5015