Repository navigation
Fix __annotations__ being undefined - #10969
Conversation
|
@JukkaL bump :) |
JukkaL
left a comment
There was a problem hiding this comment.
Ah, there's a problem with test stubs.
This comment has been minimized.
This comment has been minimized.
|
@AlexWaygood @hauntsaninja Any suggestions on stub test failures? |
|
Interesting! The In Python >= 3.10, the behaviour is different: So I'd probably say, in an ideal world:
But that sounds... complicated :// |
|
I find https://docs.python.org/3/howto/annotations.html#annotations-howto to be a useful reference. Leaving aside questions of how Line 981 in c7a8162 |
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Yeah let's just follow other dunders. |
|
Thanks for getting this over the line! |
Fix annotations being undefined
Closes #10330
Using the variable
__annotations__currently leads to an error being raised incorrectly by mypy, as shown in the example in issue #10330:print(__annotations__)This is because mypy can't find the definition of
__annotations__. This PR adds a definition of__annotations__to mypy, which means this type of error should not be raised anymore.