Issue 19895: Cryptic error when subclassing multiprocessing classes - Python tracker
Python Home About News Documentation Downloads Community Foundation Developer's Guide Issue Tracker Issues Search Random Issue Summaries Issues with patch Easy issues Stats User Administration User List Committer List Help Tracker Documentation Tracker Development Report Tracker Problem Issue19895 ➜ 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.
Created on 2013-12-05 10:35 by Antony.Lee , last changed 2022-04-11 14:57 by admin . This issue is now closed . Messages (3) msg205286 - (view) Author: Antony Lee (Antony.Lee) * Date: 2013-12-05 10:35 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. msg228410 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-10-03 23:20 @Richard have you had any thoughts about this? msg231306 - (view) Author: Dan O'Reilly (dan.oreilly) * Date: 2014-11-18 03:33 This is basically the same thing that issue21367 is reporting.
History Date User Action Args 2022-04-11 14:57:55 admin set github: 64094 2019-04-26 19:39:46 SilentGhost set status: open -> closed type: behavior superseder: multiprocessing.JoinableQueue requires new kwarg resolution: duplicate stage: resolved 2019-04-26 18:06:11 Antony.Lee set nosy: - Antony.Lee 2019-04-26 17:31:31 BreamoreBoy set nosy: - BreamoreBoy 2016-05-01 13:29:11 berker.peksag link issue21367 superseder 2014-11-18 03:33:14 dan.oreilly set nosy: + dan.oreilly messages: + msg231306 2014-10-03 23:20:15 BreamoreBoy set nosy: + BreamoreBoy messages: + msg228410 versions: + Python 3.5 2013-12-05 11:41:06 pitrou set nosy: + sbt 2013-12-05 10:35:46 Antony.Lee create Supported by The Python Software Foundation , Powered by Roundup Copyright © 1990-2022, Python Software Foundation Legal Statements