Repository navigation
Fix crash in PEP 561 module resolution - #6000
Conversation
If there was a py.typed file in a stub-only package, and it didn't contain "partial", there would be an unbound local error. To fix this, we treat it as a normal stub-only package instead.
gvanrossum
left a comment
There was a problem hiding this comment.
Definitely need to cherry-pick this. "Be liberal in what you accept" etc. (https://en.wikipedia.org/wiki/Robustness_principle)
|
Does it make sense to print a warning in the edge case? (Not sure if that would make things worse, since except if you're the package author, there's not much you can do about that warning.) |
|
Yeah I thought about that, but if |
|
Bah phones. The above should read: |
|
Oh, it would be easy to add that to https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports (where that message no redirects). So go ahead and merge now! |
If there was a py.typed file in a stub-only package, and it didn't contain "partial", there would be an unbound local error. To fix this, we treat it as a normal stub-only package instead.
If there was a
py.typedfile in a stub-only package, and it didn'tcontain
partial, there would be an unbound local error. To fix this,we treat it as a normal stub-only package if the
py.typedfile doesn'tcontain
partial.Fixes #5999
@wcooley this should fix the crash.