I want to build a wrapper class around the Python's multiprocessing.Pipe object. Inheriting from the multiprocessing module is known to have its challenges (see here for a similar question discussing inheritance for multiprocessing.Queue), and I'm facing an error I can't resolve.
Let's consider a simple example:
from multiprocessing import Pipe
class MyClass1: pass
class MyClass2(Pipe, MyClass1):
pass
Here we create a class MyClass2 that inherits both from the Pipe class and from a custom class MyClass1. Running the above will raise
TypeError: metaclass conflict: the metaclass of a derived class
must be a (non-strict) subclass of the metaclasses of all its bases
I know that to solve this error I will likely have to introduce a metaclass that MyClass2 can inherit from, but when I try to determine the metaclass of the Pipe object using type(Pipe) I get <class 'type'> which doesn't help at all.
The Stack Overflow questions I linked to above mentions that there is essentially a special way to inherit Queue. Is there also a special way for Pipe? Any suggestions on how to avoid this error?