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
Loading the module blows up with the following trace:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/rtpg/proj/pycomp/dc_example.py", line 11, in <module>
class DebugVisitor(Generic[T]):
AttributeError: attribute '__dict__' of 'type' objects is not writable
When we have the Generic + dataclass combo here, in CPy_DataclassSleightOfHand we end up trying to re-assign __dict__ to a type after applying the dataclass decorator. This issue doesn't show up if we aren't using the Generic[T] subclass.
I haven't fully isolated what's going on here, just yet though. Just wanted to at least document the issue. It kinda feels like there's a __dict__ check possible here (one thing I noticed is that in __mypyc_attrs__ we have tree_depthand__dict__ with the dataclass + Generic, but if we just have the dataclass we only have tree_depth).
The text was updated successfully, but these errors were encountered:
That dataclass code is quite tricky. In the long term we may want to completely compile away the @dataclass decorator, since it's such a basic language feature, but for now some smaller-case fix would be good to have for this issue.
With the following snippet:
Loading the module blows up with the following trace:
When we have the
Generic
+dataclass
combo here, inCPy_DataclassSleightOfHand
we end up trying to re-assign__dict__
to a type after applying thedataclass
decorator. This issue doesn't show up if we aren't using theGeneric[T]
subclass.I haven't fully isolated what's going on here, just yet though. Just wanted to at least document the issue. It kinda feels like there's a
__dict__
check possible here (one thing I noticed is that in__mypyc_attrs__
we havetree_depth
and__dict__
with the dataclass +Generic
, but if we just have the dataclass we only havetree_depth
).The text was updated successfully, but these errors were encountered: