This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sbt
Recipients allista, sbt
Date 2014-03-08.16:10:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1394295032.28.0.021625958684.issue20854@psf.upfronthosting.co.za>
In-reply-to
Content
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()
History
Date User Action Args
2014-03-08 16:10:32sbtsetrecipients: + sbt, allista
2014-03-08 16:10:32sbtsetmessageid: <1394295032.28.0.021625958684.issue20854@psf.upfronthosting.co.za>
2014-03-08 16:10:32sbtlinkissue20854 messages
2014-03-08 16:10:31sbtcreate