Mark object.__module__ as ClassVar#8787
Conversation
|
I kinda think >>> object().__module__
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'object' object has no attribute '__module__' |
|
Diff from mypy_primer, showing the effect of this PR on open source code: streamlit (https://github.com/streamlit/streamlit)
+ lib/tests/streamlit/runtime/caching/hashing_test.py:29: note: ... from here:
SinbadCogs (https://github.com/mikeshardmind/SinbadCogs)
+ devtools/core.py:193: error: Cannot assign to class variable "__module__" via instance
yarl (https://github.com/aio-libs/yarl)
+ yarl/_url.py:19: error: Cannot assign to class variable "__module__" via instance [misc]
werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/utils.py:89: error: Cannot assign to class variable "__module__" via instance [misc]
|
|
Looking at them, I'm fine with taking these primer hits, but I'm a little worried about all the stubs that have this. I'm happy to have |
I know, but I'm not sure I'm super jazzed about those things either |
An alternative approach to #8787
#8789 went down like a bag of sick, so if we want to fix this, this does indeed look like the better solution, at least for now :) |
The reported use case for this isn't particularly compelling, so if this causes too many errors I will close.