[New-bugs-announce] [issue35477] multiprocessing.Pool.__enter__() should raise an exception if called twice
report at bugs.python.org
Wed Dec 12 18:08:12 EST 2018
New submission from STINNER Victor <vstinner at redhat.com>:
On a file, "with file:" fails if it's used a second time:
fp = open('/etc/issue')
fails with "ValueError: I/O operation on closed file", because file.__enter__() raises this exception if the file is closed.
I propose to have the same behavior on multiprocessing.Pool.__enter__() to detect when the multiprocessing API is misused.
Anyway, after the first "with pool:" block, the pool becomes unusable to schedule now tasks: apply() raise ValueError("Pool not running") in that case for example.
components: Library (Lib)
title: multiprocessing.Pool.__enter__() should raise an exception if called twice
versions: Python 3.8
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce