[New-bugs-announce] [issue30018] multiprocessing.Pool garbles call stack for __new__
Charles McEachern
report at bugs.python.org
Fri Apr 7 13:25:19 EDT 2017
New submission from Charles McEachern:
I'm calling the constructor of Foo, a subclass of str. Expected output:
Called Foo.__new__ with args = ('TIMESTAMP', 'INPUT0')
TIMESTAMP OUTPUT0
When I make the call using a multiprocessing.pool.ThreadPool, it works fine. But when I make the call using a multiprocessing.Pool (using the apply or apply_async method), I get:
Called Foo.__new__ with args = ('TIMESTAMP', 'INPUT0')
Called Foo.__new__ with args = ('TIMESTAMP OUTPUT0',)
Exception in thread Thread-3:
...
ValueError: Bad Foo input: ('TIMESTAMP OUTPUT0',)
That is, the object I just constructed seems to be getting shoved right back into the constructor.
When I swap out the Foo class for the similar Goo class, which is not a str, and uses __init__ instead of __new__, I again see no problems:
Called Goo.__init__ with args = ('TIMESTAMP', 'INPUT0')
<Goo TIMESTAMP OUTPUT0>
I see this in 2.7.9 as well as 3.4.5. Looks like it's present in 2.7.2 and 3.5.2 as well:
https://github.com/charles-uno/python-new-pool-bug/issues/1
----------
components: Library (Lib)
files: newpool.py
messages: 291278
nosy: Charles McEachern
priority: normal
severity: normal
status: open
title: multiprocessing.Pool garbles call stack for __new__
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file46790/newpool.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30018>
_______________________________________
More information about the New-bugs-announce
mailing list