New submission from STINNER Victor <vstin...@redhat.com>:
On a file, "with file:" fails if it's used a second time: --- fp = open('/etc/issue') with fp: print("first") with fp: print("second") --- 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) messages: 331719 nosy: vstinner priority: normal severity: normal status: open title: multiprocessing.Pool.__enter__() should raise an exception if called twice versions: Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35477> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com