You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
New semantic analyzer: Support idem forward aliases #6404
Oh, wait, this is actually correct, by the rules non-indexed assignments at class scope are always variables, so this was previously a false negative, OK back to normal priority.
The examples look meaningless, since the code won't work at runtime. I wonder if the actual code where this comes up is different (involving try/except perhaps). This could also affect the way we'd fix this.
Most likely, I don't remember TBH, also aiohttp (who first reported this) used to have tons of * imports. This may be some other name they define in another module depending on sys.platform and then star import it.
Activity
ilevkivskyi commentedon Mar 14, 2019
EDIT: The new behavior is actually correct, see below.
Another pattern that we need to support with new semantic analyzer is this:this currently (both before and after assignment refactor) causes a bunch of troubles in internal code bases. Raising priority to high.ilevkivskyi commentedon Mar 14, 2019
Oh, wait, this is actually correct, by the rules non-indexed assignments at class scope are always variables, so this was previously a false negative, OK back to normal priority.
ilevkivskyi commentedon Jun 7, 2019
Another repro for this issue with a weird error:
fails with
cc @JukkaL
JukkaL commentedon Jul 3, 2019
The examples look meaningless, since the code won't work at runtime. I wonder if the actual code where this comes up is different (involving try/except perhaps). This could also affect the way we'd fix this.
ilevkivskyi commentedon Jul 3, 2019
Yes, the actual code is like
Also the second example works without try/except.
I think we should fix this before the release since this is actually used in some projects.
JukkaL commentedon Jul 3, 2019
Yes, it would be good to make this better. I'm increasing priority.
But even that example seems incomplete, as that will always generate a
NameError. I assume it's more like this:The assignment will fail on some Python versions and pass on some.
ilevkivskyi commentedon Jul 3, 2019
Most likely, I don't remember TBH, also
aiohttp(who first reported this) used to have tons of*imports. This may be some other name they define in another module depending onsys.platformand then star import it.ilevkivskyi commentedon Jul 3, 2019
I did some digging and it looks like this happens sometimes after star imports from C acceleration modules.
New semantic analyzer: fix issues with 'X = X' assignments
New semantic analyzer: fix issues with 'X = X' assignments (#7144)