You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
>>> classQ(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
>>> classQ(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.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: