◐ Shell
clean mode source ↗

Message 396035 - Python tracker

This is still the same in 3.11:

>>> import pickle
>>> class CustomException(Exception):
...     def __init__(self, arg1, arg2):
...         msg = "Custom message {} {}".format(arg1, arg2)
...         super().__init__(msg)
...
>>> obj_dump = pickle.dumps(CustomException("arg1", "arg2"))
>>> obj = pickle.loads(obj_dump)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: CustomException.__init__() missing 1 required positional argument: 'arg2'
>>>