mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #28779: multiprocessing.set_forkserver_preload() would crash the forkserver process if a preloaded module instantiated some multiprocessing objects such as locks.
This commit is contained in:
parent
7a44783b42
commit
cd2a201e5b
5 changed files with 37 additions and 2 deletions
18
Lib/test/mp_preload.py
Normal file
18
Lib/test/mp_preload.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
import multiprocessing
|
||||
|
||||
multiprocessing.Lock()
|
||||
|
||||
|
||||
def f():
|
||||
print("ok")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
ctx = multiprocessing.get_context("forkserver")
|
||||
modname = "test.mp_preload"
|
||||
# Make sure it's importable
|
||||
__import__(modname)
|
||||
ctx.set_forkserver_preload([modname])
|
||||
proc = ctx.Process(target=f)
|
||||
proc.start()
|
||||
proc.join()
|
Loading…
Add table
Add a link
Reference in a new issue