-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
False positive involving re.sub
and +
operator introduced in mypy 0.960
#12961
Comments
Bisection shows that this was introduced by 7fbf4de ("Sync typeshed"). I'm not sure if this indicates s typeshed bug or just something that a typeshed change happened to expose? |
Ahh, digging into the typeshed change (python/typeshed#7679) this looks like this is probably related to (duplicate of?) #12665 |
Or #12773 (cc. @JukkaL, @JelleZijlstra) |
Yup, duplicate of #12666 / 12665 |
The issue is probably something like we're not correctly silencing errors in the earlier passes for the multipass lambda logic |
Bug Report
Consider the following snippet. (This is a minified example of the problem detected in matrix-org/synapse#12996.)
Mypy 0.950 is happy with this, but mypy 0.960 is not.
AFAICS this is a legitimate usage of re.sub, consistent with the stubs defined in typeshed.
Additional
Strangely, removing either of the addition operators and the corresponding string literal causes mypy 0.960 to accept the snippet. That is, applying this change
is accepted, and applying this change
to the vanilla snippet above is also accepted.
I'm not sure how to get mypy to reveal the type of an expression in a lambda body, but I'd guess that in the error cases it deduces
match: Match[bytes]
rather thanmatch: Match[str]
?The text was updated successfully, but these errors were encountered: