Author vstinner
Recipients vstinner
Date 2018-12-12.23:08:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
On a file, "with file:" fails if it's used a second time:
fp = open('/etc/issue')
with fp:
with fp:

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.
Date User Action Args
2018-12-12 23:08:12vstinnersetrecipients: + vstinner
2018-12-12 23:08:12vstinnersetmessageid: <>
2018-12-12 23:08:12vstinnerlinkissue35477 messages
2018-12-12 23:08:12vstinnercreate