Message102423
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). |
|
Date |
User |
Action |
Args |
2010-04-05 22:45:18 | rschoon.old | set | recipients:
+ rschoon.old |
2010-04-05 22:45:18 | rschoon.old | set | messageid: <1270507518.5.0.340159262485.issue8323@psf.upfronthosting.co.za> |
2010-04-05 22:45:17 | rschoon.old | link | issue8323 messages |
2010-04-05 22:45:16 | rschoon.old | create | |
|