[issue35477] multiprocessing.Pool.__enter__() should raise an exception if called twice

STINNER Victor report at bugs.python.org
Wed Dec 12 18:16:11 EST 2018


STINNER Victor <vstinner at redhat.com> added the comment:

Currently, the error only occurs when apply() is called:
---
import multiprocessing

def the_test():
    pool = multiprocessing.Pool(1)
    with pool:
        print(pool.apply(int, (2,)))
    with pool:
        print(pool.apply(int, (3,))) # <-- raise here

the_test()
---

I would prefer to get an error on at the second "with pool:" line.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35477>
_______________________________________


More information about the Python-bugs-list mailing list