Example on Windows:
importsubprocessprogram=r"PCbuild\amd64\_testembed_d.exe"cmd= [program, "test_repeated_init_exec", "import _ctypes"]
foriinrange(1, 11):
print(f" == Process #{i} ===")
proc=subprocess.run(cmd)
exitcode=proc.returncodeprint(f"=> exitcode {exitcode}")
ifexitcode:
breakprint()Output:
vstinner@WIN C:\victor\python\main>python bug.py Running Debug|x64 interpreter...
== Process #1 ===
--- Loop #1 ---
--- Loop #2 ---
--- Loop #3 ---
--- Loop #4 ---
=> exitcode 0
== Process #2 ===
--- Loop #1 ---
--- Loop #2 ---
Assertion failed: PyUnicode_CheckExact(ep->me_key), file C:\victor\python\main\Objects\dictobject.c, line 922
=> exitcode 3
Example on Windows:
Output: