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 Antony.Lee
Recipients Antony.Lee
Date 2013-12-05.10:35:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Classes defined in the multiprocessing module are in fact functions that call the internally defined class constructor with the "ctx" argument properly set; because of that, trying to subclass them yields a (very?) cryptic error message:

>>> import multiprocessing as m, multiprocessing.queues as q
>>> class Q(m.Queue): pass # normal attempt fails
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: function() argument 1 must be code, not str
>>> class Q(q.Queue): pass # that one works fine

I guess the error message here could be improved, and the limitation and the workaround should be mentioned in the docs.  Even better would be to  have real classes directly in the multiprocessing module rather than wrappers, although I believe that would require sorting out some circular import issues.
Date User Action Args
2013-12-05 10:35:46Antony.Leesetrecipients: + Antony.Lee
2013-12-05 10:35:46Antony.Leesetmessageid: <>
2013-12-05 10:35:46Antony.Leelinkissue19895 messages
2013-12-05 10:35:45Antony.Leecreate