Frozen dataclass exception reraise
Raising an exception decorated as a frozen dataclass, inside an
except clause, causes
dataclasses.FrozenInstanceError: cannot assign to field '__context__'.
This code works as expected (raises
MyException) on CPython 3.8.9 (and all versions after that too), but not on PyPy 3.8.12 (7.3.7):
from dataclasses import dataclass @dataclass(frozen=True) class MyException(Exception): code: int try: 1 / 0 except ZeroDivisionError: raise MyException(3)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information