[New-bugs-announce] [issue10886] Unhelpful backtrace for multiprocessing.Queue

Torsten Landschoff report at bugs.python.org
Tue Jan 11 12:16:59 CET 2011


New submission from Torsten Landschoff <t.landschoff at gmx.net>:

When trying to send an object via a Queue that can't be pickled, one gets a quite unhelpful traceback:

Traceback (most recent call last):
  File "/usr/lib/python2.6/multiprocessing/queues.py", line 242, in _feed
    send(obj)
PicklingError: Can't pickle <type 'module'>: attribute lookup __builtin__.module failed

I have no idea where I am sending this. It would be helpful to get the call trace to the call to Queue.put.

My workaround was to create a Queue via this function MyQueue:

def MyQueue():
    import cPickle
    def myput(obj, *args, **kwargs):
        cPickle.dumps(obj)
        return orig_put(obj, *args, **kwargs)

    q = Queue()
    orig_put, q.put = q.put, myput
    return q

That way I get the pickle exception in the caller to put and was able to find out the offending code.

----------
components: Library (Lib)
messages: 125996
nosy: torsten
priority: normal
severity: normal
status: open
title: Unhelpful backtrace for multiprocessing.Queue
type: feature request
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10886>
_______________________________________


More information about the New-bugs-announce mailing list