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 rschoon.old
Recipients rschoon.old
Date 2010-04-05.22:45:16
SpamBayes Score 1.3195e-13
Marked as misclassified No
Message-id <1270507518.5.0.340159262485.issue8323@psf.upfronthosting.co.za>
In-reply-to
Content
The multiprocessing module's version of the Queue class, which causes objects to be pickled for process to process transfer, ignores pickle restrictions when objects are added to the queue.  Example code (buffer isn't pickleable):

    from multiprocessing import Queue

    q = Queue()
    q.put(buffer("this is a buffer"))
    print(q.get())

It results in an exception, which is expected, but the exception is confusing, after the problem has already occurred, and if I were actually using multiple processes, not in the process that tried to send an unsendable object:

Traceback (most recent call last):                                                           
  File "mppkbuffer.py", line 5, in <module>                                                
    print(q.get())
  File "/usr/lib/python2.6/multiprocessing/queues.py", line 91, in get
    res = self._recv()
TypeError: buffer() takes at least 1 argument (0 given)

Expected result would be a thrown exception when we attempt to put the object into the queue using .put(), NOT when we attempt pull it out of the queue using .get(), when it gets unpickled.  Basically, while pickle fails when it tries to dump, Queue succeeds the dump (somehow) and fails to load.

I have tested with python 2.6.4 and 2.7a4.  3.1 doesn't appear to have this bug (but it does have a different one which I will report later).
History
Date User Action Args
2010-04-05 22:45:18rschoon.oldsetrecipients: + rschoon.old
2010-04-05 22:45:18rschoon.oldsetmessageid: <1270507518.5.0.340159262485.issue8323@psf.upfronthosting.co.za>
2010-04-05 22:45:17rschoon.oldlinkissue8323 messages
2010-04-05 22:45:16rschoon.oldcreate