Richard Oudkerk added the comment:
I am not sure method_to_typeid and create_method were really intended to be
public -- they are only used by Pool proxies.
You can maybe work around the problem by registering a second typeid without
specifying callable. That can be used in method_to_typeid:
import multiprocessing.managers
class MyClass(object):
def __init__(self):
self._children = {}
def get_child(self, i):
return self._children.setdefault(i, type(self)())
def __repr__(self):
return '<MyClass %r>' % self._children
class MyManager(multiprocessing.managers.BaseManager):
pass
MyManager.register('MyClass', MyClass,
method_to_typeid = {'get_child': '_MyClass'})
MyManager.register('_MyClass',
method_to_typeid = {'get_child': '_MyClass'},
create_method=False)
if __name__ == '__main__':
m = MyManager()
m.start()
try:
a = m.MyClass()
b = a.get_child(1)
c = b.get_child(2)
d = c.get_child(3)
print a # <MyClass {1: <MyClass {2: <MyClass {3: <MyClass {}>}>}>}>
finally:
m.shutdown()
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue20854>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com