[issue42962] Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)

2021-12-11 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> missing return in win32_kill? ___ Python tracker ___

[issue42962] Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)

2021-03-08 Thread STINNER Victor
Change by STINNER Victor : -- nosy: -vstinner ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42962] Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)

2021-02-26 Thread El Samuko
El Samuko added the comment: I'm getting [WinError 87], too, when using the PID. -- ___ Python tracker ___ ___ Python-bugs-list

[issue42962] Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)

2021-02-26 Thread El Samuko
El Samuko added the comment: @eryksun I can run the script successfully under cygwin and mingw(git bash). The python version is 3.9.2 -- ___ Python tracker ___

[issue42962] Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)

2021-02-26 Thread Eryk Sun
Eryk Sun added the comment: El Samuko, is that a Windows (Win32), Cygwin, MSYS2, WSL, or some other version of bash? The same for Python, and which version of Python is it. With these details, I can tell you what `os.kill($WINPID, signal.CTRL_C_EVENT)"` is probably doing. --

[issue42962] Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)

2021-02-26 Thread El Samuko
El Samuko added the comment: FWIW, I could send CTRL-C to ffmpeg (else it won't write a valid mp4 header) under Windows by using the WINPID and not the PID returned from ps . ``` WINPID=$(ps aux | grep ffmpeg | awk '{print $4}') python -c "import os, signal; os.kill($WINPID,

[issue42962] Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)

2021-01-23 Thread Eryk Sun
Eryk Sun added the comment: Thanks, Terry. I should have followed up with a short message asking for a core developer to sign off on that suggestion, in which case this is an "easy (C)" issue. -- ___ Python tracker

[issue42962] Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)

2021-01-23 Thread Terry J. Reedy
Terry J. Reedy added the comment: If I understand correctly, this is open for someone to evaluate Eryk's suggestion in msg385291 that a 'missing' return be added to win32_kill. -- nosy: +terry.reedy versions: -Python 3.7 ___ Python tracker

[issue42962] Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)

2021-01-19 Thread Eryk Sun
Eryk Sun added the comment: > That's what Lib/test/win_console_handler.py:39 does. No, that script is currently broken. SetConsoleCtrlHandler(None, False) clears the Ctrl+C ignore flag in the PEB ProcessParameters, which is normally inherited by child processes. But using the

[issue42962] Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)

2021-01-19 Thread William Schwartz
William Schwartz added the comment: >For a new process group, the cancel event is initially ignored, but the break >event is always handled. To enable the cancel event, the process must call >SetConsoleCtrlHandler(NULL, FALSE), such as via ctypes with >kernel32.SetConsoleCtrlHandler(None,

[issue42962] Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)

2021-01-19 Thread Eryk Sun
Eryk Sun added the comment: > Should there be a `return NULL;` between these two lines? In 3.x, os.kill() has always fallen back on TerminateProcess() when GenerateConsoleCtrlEvent() fails, and I assumed that was intentional. But I misunderstood that it's not actually chaining the exception

[issue42962] Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)

2021-01-19 Thread William Schwartz
William Schwartz added the comment: > Fixing the SystemError should be simple. Just clear an existing error if > TerminateProcess() succeeds. Should there be a `return NULL;` between these two lines?

[issue42962] Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)

2021-01-19 Thread Eryk Sun
Eryk Sun added the comment: > I just reported it because the SystemError indicates that a C-API function > was returning non-NULL even after PyErr_Occurred() returns true Fixing the SystemError should be simple. Just clear an existing error if TerminateProcess() succeeds. > Windows Command

[issue42962] Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)

2021-01-18 Thread STINNER Victor
Change by STINNER Victor : -- nosy: +vstinner ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42962] Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)

2021-01-18 Thread William Schwartz
William Schwartz added the comment: > In Windows, os.kill() is a rather confused function. I know how it feels. To be honest, I don't have an opinion about whether the steps I laid out ought to work. I just reported it because the SystemError indicates that a C-API function was returning

[issue42962] Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)

2021-01-18 Thread Eryk Sun
Eryk Sun added the comment: > 4. In console A, type the PID from console B and execute the command. In Windows, os.kill() is a rather confused function. In particular, it confuses a process ID (pid) with a process group ID (pgid). If the signal is CTRL_C_EVENT or CTRL_BREAK_EVENT, it first

[issue42962] Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)

2021-01-18 Thread Petr Viktorin
Change by Petr Viktorin : -- nosy: -petr.viktorin ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42962] Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)

2021-01-18 Thread William Schwartz
New submission from William Schwartz : 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