-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
assert failing in lookup_qualified_node with -i/--incremental #3259
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
Comments
And guess what the value of @pkch or @ilevkivskyi -- any idea? |
(And the source file is |
python 2 or 3? |
Python 3. |
I haven't pinpointed it yet but I fear it's another import cycle, probably involving |
(Sorry for the many messages.) This is in fixup_module_pass_one() for importlib/abc.pyi. This module is fake-defining Loader, which it actually imports from
However (presumably due to the magic renaming going on here) the cache file importlib/abc.data.json contains the full definition for the Loader class, while the cache file for I think there's another rename or anti-rename missing, but I haven't figured it out yet. |
Maybe my entire solution in #3203 and #3235 should be replaced with something more fundamental. I'm thinking maybe we should not create a symbol table for Alternatively, we can make mypy handle arbitrarily re-exported of names between modules, although I doubt it's worth it. |
Maybe the problem is simpler, there is code: if '_importlib_modulespec' in modules:
# we are using python 3, so renaming is necessary
name = rev_module_rename_map.get(name, name) But IIUC the name is actually |
Yes, that name would not be renamed. But if that name appears, it's a problem with the original renaming. By the time we're in this code, we should not be seeing So maybe my original renaming isn't comprehensive enough. I rename |
I reproduced the error, looking into it now. |
Actually the renaming inside My original idea in #3203 was that these names will continue to live inside The crash happened because the symbol that was found is defective; it's Before trying to fix it, I wanted to see why I redirected In short, I think my #3203 + #3235 are not good, since they create two separate symbols that correspond to the same item. Let's figure out if the original crash I was fixing is still a risk, and if so, what's a proper way to fix it is. |
This is a bit disturbing. There don't seem to be any typeshed log entries for importlib, so I'm not sure what to think of that theory. But I do think that maybe #3202 did not require urgent fixing, and the current crashes do, so maybe rolling back both #3203 and #3235 is best. (And please do at least verify that you no longer have this crash -- I'm not sure if I can repro the previous one.) |
The repro for both crashes is here:
I am going to roll back #3203 and #3235. I suspect the problem they were trying to solve was due to the fact that The important thing is that for now, at least, the crashes do not happen with the two PRs rolled back. If anyone experiences them again, we can come back to this discussion. |
Well, to be more precise... Reverting the #3203, #3235 and some of the changes in my older PR #3107 removes both crashes. The only feature we lose is that Let's deal with the |
@pkch |
Should we add the repro from my comment above as a new regression test? Or it's pretty safe with the offending code removed? |
Yes, please add such a test. Maybe it can go in check-incremental.test? (Or is the need to run with |
Hmm so far I've been able to repro it only with a command-line test which unfortunately is too slow (10 sec). I'll try again later. |
Oh, this may be because the check*test files use fake stubs. There are some other tests that use real stubs. But 10 seconds? That seems excessive. |
I've got some proprietary code where mypy reliably crashes on the second
-i
run, as follows:The text was updated successfully, but these errors were encountered: