Message331719
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. |
|
Date |
User |
Action |
Args |
2018-12-12 23:08:12 | vstinner | set | recipients:
+ vstinner |
2018-12-12 23:08:12 | vstinner | set | messageid: <1544656092.37.0.788709270274.issue35477@psf.upfronthosting.co.za> |
2018-12-12 23:08:12 | vstinner | link | issue35477 messages |
2018-12-12 23:08:12 | vstinner | create | |
|