Below is a min. reproducible code:
import multiprocessing
class E(Exception):
def __init__(self, a1, a2):
Exception.__init__(self, '{}{}'.format(a1, a2))
def f(_):
raise E(1, 2)
multiprocessing.Pool(1).map(f, (1,))
This gives below error:
Exception in thread Thread-5:
Traceback (most recent call last):
File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/usr/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python3.7/multiprocessing/pool.py", line 496, in _handle_results
task = get()
File "/usr/lib/python3.7/multiprocessing/contrnection.py", line 251, in recv
return _ForkingPickler.loads(buf.getbuffer())
TypeError: __init__() missing 1 required positional argument: 'a2'
Any way to fix this? Similar issue is mentioned here: https://bugs.python.org/issue39751