[issue11155] multiprocessing.Queue's put() signature differs from docs
New submission from Erik Cederstrand <ec@1calendar.dk>: In Python 2.6.6 on OSX:
import inspect from multiprocessing import Queue q = Queue() print(inspect.getargspec(q.put)) ArgSpec(args=['self', 'obj', 'block', 'timeout'], varargs=None, keywords=None, defaults=(True, None)) from Queue import Queue q = Queue() print(inspect.getargspec(q.put)) ArgSpec(args=['self', 'item', 'block', 'timeout'], varargs=None, keywords=None, defaults=(True, None))
Notice the 'obj' argument in the multiprocessing version and the 'item' argument in the Queue version. I think 'obj' should be renamed to 'item' to be in line with the other implementation and to agree with the docs: (http://docs.python.org/library/multiprocessing.html?highlight=multiprocessin...): put(item[, block[, timeout]]) ---------- assignee: docs@python components: Documentation messages: 128200 nosy: Erik.Cederstrand, docs@python priority: normal severity: normal status: open title: multiprocessing.Queue's put() signature differs from docs versions: Python 2.6 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11155> _______________________________________
Westley Martínez <anikom15@gmail.com> added the comment: I've gone through Lib/multiproccing/queues.py and have replaced obj with item. Here's the patch. ---------- keywords: +patch nosy: +anikom15 Added file: http://bugs.python.org/file20720/multiprocessing-11155.diff _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11155> _______________________________________
Westley Martínez <anikom15@gmail.com> added the comment: Well it's been quite some time and no response yet. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11155> _______________________________________
Erik Cederstrand <ec@1calendar.dk> added the comment: I'm not sure if I was supposed to respond. The patch looks straight-forward to me. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11155> _______________________________________
Changes by Ezio Melotti <ezio.melotti@gmail.com>: ---------- nosy: +ezio.melotti _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11155> _______________________________________
Erik Cederstrand <ec@1calendar.dk> added the comment: Just checked on Python 2.7.1 with the same result. Test script attached. ---------- Added file: http://bugs.python.org/file21459/q.py _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11155> _______________________________________
Changes by Erik Cederstrand <ec@1calendar.dk>: ---------- versions: +Python 2.7 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11155> _______________________________________
Ezio Melotti <ezio.melotti@gmail.com> added the comment: Technically this is a backward-incompatible change, because it breaks code that uses obj=foo explicitly. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11155> _______________________________________
Westley Martínez <anikom15@gmail.com> added the comment: In that case, I've made a patch that changes the documentation so that "item" is now "obj". for Queue.put and Queue.put_nowait. ---------- Added file: http://bugs.python.org/file21484/doc-11155.diff _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11155> _______________________________________
Westley Martínez <anikom15@gmail.com> added the comment: Can this patch be commited? ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11155> _______________________________________
Westley Martínez <anikom15@gmail.com> added the comment: ¡Hola! Just checking in. The documentation is still incorrect for all versions. There's a patch that fixes it ready to be reviewed. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11155> _______________________________________
Changes by Eli Bendersky <eliben@gmail.com>: ---------- nosy: +eli.bendersky _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11155> _______________________________________
Senthil Kumaran <senthil@uthcode.com> added the comment: anikom15's first patch seems correct. In the multiprocessing.py, the the arg 'obj' can be safely replaced with 'item' to be consistent with the docs. As this is not a keyword arg, it does not stand any chance of breaking any backwards compatibility. It looks me to that when multiprocessing' Queue.put was coding the first arg was wrongly mentioned as 'obj' instead of 'item'. I shall commit the first patch unless someone objects to the above reasoning. ---------- assignee: docs@python -> orsenthil nosy: +orsenthil _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11155> _______________________________________
Senthil Kumaran <senthil@uthcode.com> added the comment: Well, I should take back my previous comment. I realized that the positional arg in this case can be called as keyword arg. It would be wrong to change multiprocessing.py and it is correct to change the docs. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11155> _______________________________________
Roundup Robot <devnull@psf.upfronthosting.co.za> added the comment: New changeset c6d4d4d64405 by Senthil Kumaran in branch '3.2': Fix closes Issue11155 - Correct the multiprocessing.Queue.put's arg (replace 'item' with 'obj') in the docs. Patch by Westley Martínez. http://hg.python.org/cpython/rev/c6d4d4d64405 New changeset 8f1187288fac by Senthil Kumaran in branch 'default': merge from 3.2. Fix closes Issue11155 - Correct the multiprocessing.Queue.put's arg (replace 'item' with 'obj') in the docs. Patch by Westley Martínez. http://hg.python.org/cpython/rev/8f1187288fac New changeset d29c9006d770 by Senthil Kumaran in branch '2.7': merge from 3.2. Fix closes Issue11155 - Correct the multiprocessing.Queue.put's arg (replace 'item' with 'obj') in the docs. Patch by Westley Martínez. http://hg.python.org/cpython/rev/d29c9006d770 ---------- nosy: +python-dev resolution: -> fixed stage: -> committed/rejected status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11155> _______________________________________
participants (6)
-
Eli Bendersky -
Erik Cederstrand -
Ezio Melotti -
Roundup Robot -
Senthil Kumaran -
Westley Martínez