bpo-35917: Test multiprocessing manager classes and shareable types by giampaolo · Pull Request #11772 · python/cpython
@giampaolo I think you misunderstood the test failures. A RLock can only be released by the thread/process which acquired it. Example:
>>> import threading >>> lock = threading.RLock() >>> lock.acquire() True >>> t = threading.Thread(target=lock.release) >>> t.start() Exception in thread Thread-1990: Traceback (most recent call last): File "/home/antoine/miniconda3/envs/pyarrow/lib/python3.7/threading.py", line 917, in _bootstrap_inner self.run() File "/home/antoine/miniconda3/envs/pyarrow/lib/python3.7/threading.py", line 865, in run self._target(*self._args, **self._kwargs) RuntimeError: cannot release un-acquired lock
Same with multiprocessing:
>>> lock = mp.RLock() >>> lock.acquire() True >>> proc = mp.Process(target=lock.release) >>> proc.start() Process Process-1: >>> Traceback (most recent call last): File "/home/antoine/miniconda3/envs/pyarrow/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap self.run() File "/home/antoine/miniconda3/envs/pyarrow/lib/python3.7/multiprocessing/process.py", line 99, in run self._target(*self._args, **self._kwargs) AssertionError: attempt to release recursive lock not owned by thread
So you should write the RLock and Condition tests differently.