This seems to run forerever which is not expected. Reason seems to be that that somehow, super().process actually calls B.process instead of A.process in the subprocess. This is not expected behaviour. As additional evidence towards that, the program behaviour can be corrected by changing
To summarize that unexpected behavior, super().process method is somehow overridden when calling multiprocessing.Process.start().
I found that we can get the expected result by using multiprocessing.Process.run().
import multiprocessing as mp
class A(object):
def process(self):
print("method of A")
class B(A):
def foo(self):
mp.Process(target=super().process).run() # "method of A" is printed
mp.Process(target=super().process).start() # "method of B" is printed
def process(self):
print("method of B")
if __name__ == "__main__":
b = B()
b.foo()
I will dive deeper to find what makes that difference.
bsdis commentedSep 1, 2022
•
edited
This is a bug report:
This seems to run forerever which is not expected. Reason seems to be that that somehow, super().process actually calls B.process instead of A.process in the subprocess. This is not expected behaviour. As additional evidence towards that, the program behaviour can be corrected by changing
with
Machine:
MacBook Pro (16-inch, 2021)
MacOS Monteray 12.5
Chip: Apple M1 Max
Python version: 3.9.12
The text was updated successfully, but these errors were encountered: