New submission from William Schwartz <wkschwa...@gmail.com>:
I don't have an automated test at this time, but here's how to get os.kill to raise SystemError. I did this on Windows 10 version 20H2 (build 19042.746) with Pythons 3.7.7, 3.8.5, and 3.9.1. os_kill_impl at Modules/posixmodule.c:7833 does not appear to have been modified recently (but I haven't checked its transitive callees), so I imagine you can get the same behavior from os.kill on Python 3.10. 1. Open two consoles, A and B. (I'm using tabs in Windows Terminal, if that matters.) 2. In console A, type but DO NOT EXECUTE the following command: python -c"import os, signal; os.kill(, signal.CTRL_C_EVENT)" Move your cursor back before the comma. 3. In console B, create a process that does nothing but print its process identifier and wait long enough for you to type it in console A: python -c"import os, time; print(os.getpid()); time.sleep(60); print('exiting cleanly')" Copy or remember the printed PID. Hurry to step 4 before your 60 seconds expires! 4. In console A, type the PID from console B and execute the command. 5. In console B, confirm that the Python exited without printing "exiting cleanly". Oddly, `echo %errorlevel%` will print `0` rather than `-1073741510` (which is `2**32 - 0xc000013a`, the CTRL_C_EVENT exit code), which is what it prints after `python -c"raise KeyboardInturrupt"`. 6. In console A, you should see the following traceback. OSError: [WinError 87] The parameter is incorrect The above exception was the direct cause of the following exception: Traceback (most recent call last): File "<string>", line 1, in <module> SystemError: <built-in function kill> returned a result with an error set ---------- components: Extension Modules, Windows messages: 385235 nosy: William.Schwartz, ncoghlan, paul.moore, petr.viktorin, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT) type: behavior versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42962> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com