This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author William.Schwartz
Recipients William.Schwartz, ncoghlan, paul.moore, petr.viktorin, steve.dower, tim.golden, zach.ware
Date 2021-01-18.22:12:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1611007954.59.0.488720921329.issue42962@roundup.psfhosted.org>
In-reply-to
Content
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
History
Date User Action Args
2021-01-18 22:12:34William.Schwartzsetrecipients: + William.Schwartz, paul.moore, ncoghlan, tim.golden, petr.viktorin, zach.ware, steve.dower
2021-01-18 22:12:34William.Schwartzsetmessageid: <1611007954.59.0.488720921329.issue42962@roundup.psfhosted.org>
2021-01-18 22:12:34William.Schwartzlinkissue42962 messages
2021-01-18 22:12:33William.Schwartzcreate