[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-10-05 Thread Łukasz Langa
Łukasz Langa added the comment: New changeset c26a666e6751a9fad766ef83432b893f9b15ecaf by Łukasz Langa in branch '3.9': [3.9] bpo-41602: raise SIGINT exit code on KeyboardInterrupt from pymain_run_module (GH-21956) (#22397) https://github.com/python/cpython/commit/c26a666e6751a9fad766ef83432b

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-09-24 Thread Łukasz Langa
Łukasz Langa added the comment: New changeset ae462297c08515f2c0dacf77b04816504142ba3e by Thomas Grainger in branch '3.8': [3.8] bpo-41602: raise SIGINT exit code on KeyboardInterrupt from pymain_run_module (GH-21956) (#22398) https://github.com/python/cpython/commit/ae462297c08515f2c0dacf77b

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-09-24 Thread Thomas Grainger
Change by Thomas Grainger : -- pull_requests: +21438 pull_request: https://github.com/python/cpython/pull/22398 ___ Python tracker ___ _

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-09-24 Thread Łukasz Langa
Łukasz Langa added the comment: New changeset ca8d46dd422e5aa10f444796d93faec5a8cbc1e0 by Łukasz Langa in branch '3.9': [3.9] bpo-41602: raise SIGINT exit code on KeyboardInterrupt from pymain_run_module (GH-21956) (#22397) https://github.com/python/cpython/commit/ca8d46dd422e5aa10f444796d93f

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-09-24 Thread Łukasz Langa
Change by Łukasz Langa : -- nosy: +lukasz.langa nosy_count: 5.0 -> 6.0 pull_requests: +21437 pull_request: https://github.com/python/cpython/pull/22397 ___ Python tracker ___ __

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-09-24 Thread Łukasz Langa
Change by Łukasz Langa : -- versions: +Python 3.10 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-09-22 Thread Guido van Rossum
Guido van Rossum added the comment: New changeset a68a2ad19c891faa891904b3da537911cc77df21 by Thomas Grainger in branch 'master': bpo-41602: raise SIGINT exit code on KeyboardInterrupt from pymain_run_module (#21956) https://github.com/python/cpython/commit/a68a2ad19c891faa891904b3da537911cc

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-09-22 Thread Guido van Rossum
Change by Guido van Rossum : -- resolution: -> fixed stage: needs patch -> resolved status: open -> closed ___ Python tracker ___ _

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-09-16 Thread Thomas Grainger
Thomas Grainger added the comment: nice the tests pass with that fix -- ___ Python tracker ___ ___ Python-bugs-list mailing list Un

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-09-16 Thread Guido van Rossum
Guido van Rossum added the comment: Why did you remove 3.10? -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscrib

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-09-16 Thread Thomas Grainger
Thomas Grainger added the comment: I pushed that patch -- versions: -Python 3.10 ___ Python tracker ___ ___ Python-bugs-list maili

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-09-16 Thread Guido van Rossum
Guido van Rossum added the comment: Thanks, I think this is the fix: diff --git a/Modules/main.c b/Modules/main.c index 4a76f4461b..3d1bbee3a0 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -288,6 +288,10 @@ pymain_run_module(const wchar_t *modname, int set_argv0) return pymain_e

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-09-16 Thread Guido van Rossum
Change by Guido van Rossum : -- stage: patch review -> needs patch versions: +Python 3.10 ___ Python tracker ___ ___ Python-bugs-lis

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-09-16 Thread Thomas Grainger
Thomas Grainger added the comment: I'm assuming _Py_UnhandledKeyboardInterrupt is getting incorrectly cleared somewhere in here https://github.com/python/cpython/blob/fc23a9483ef0d7c98bea9f82392377d0b6ef7b18/Modules/main.c#L291-L300 Py_DECREF(runpy); Py_DECREF(runmodule); Py_DECR

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-09-16 Thread Guido van Rossum
Guido van Rossum added the comment: Okay, so according to eryksun the fix requires C code. @graingert, are you interested in developing such a fix? Or @eryksun do you have an idea on how to fix it? -- ___ Python tracker

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-09-16 Thread Thomas Grainger
Thomas Grainger added the comment: > Okay, I got it. Now my next question. What do you mean by "I've eliminated > runpy" and various other remarks along those lines? I can use `runpy._run_module_as_main` from another Python entry, eg -c and get the correct `-2` >>> subprocess.run(["python3"

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-09-16 Thread Eryk Sun
Eryk Sun added the comment: > The return code of python on linux when the program is ended with > a KeyboardInterrupt should be -2 In general, the exit status for an unhandled KeyboardInterrupt (i.e. _Py_UnhandledKeyboardInterrupt) should be the same as the default SIGINT handler. This is i

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-09-16 Thread Guido van Rossum
Guido van Rossum added the comment: Okay, I got it. Now my next question. What do you mean by "I've eliminated runpy" and various other remarks along those lines? Have you actually identified the root cause of the problem? What's your suggested fix (without test framework). --

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-09-16 Thread Thomas Grainger
Thomas Grainger added the comment: The return code of python on linux when the program is ended with a KeyboardInterrupt should be -2, this works in most cases - except when called via "python -m" Does this repl help? Python 3.8.2 (default, Jul 16 2020, 14:00:26) [GCC 9.3.0] on linux Type

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-09-16 Thread Guido van Rossum
Guido van Rossum added the comment: Thomas, can you explain the problem in English? Those elaborate test programs don’t do it for me, sorry. -- ___ Python tracker ___

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-09-16 Thread Thomas Grainger
Thomas Grainger added the comment: adding `__main__` owners to nosy -- nosy: +gvanrossum ___ Python tracker ___ ___ Python-bugs-lis

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-09-01 Thread STINNER Victor
Change by STINNER Victor : -- nosy: -vstinner ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-08-25 Thread Thomas Grainger
Thomas Grainger added the comment: I've confirmed that the pymain_run_module fails on master in the same way with Mac, Windows and Ubuntu -- ___ Python tracker ___ __

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-08-25 Thread Thomas Grainger
Change by Thomas Grainger : -- keywords: +patch pull_requests: +21065 stage: -> patch review pull_request: https://github.com/python/cpython/pull/21956 ___ Python tracker ___

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-08-23 Thread Thomas Grainger
Change by Thomas Grainger : -- type: -> behavior ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-08-21 Thread Thomas Grainger
Thomas Grainger added the comment: adding vstinner, as this seems related to pymain_run_module rather than runpy -- nosy: +vstinner ___ Python tracker ___

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-08-20 Thread Thomas Grainger
Thomas Grainger added the comment: I've now eliminated pymain_run_stdin and pymain_run_command, both process a KeyboardInterrupt as -2 see attached test_exit_command_stdin.py -- Added file: https://bugs.python.org/file49417/test_exit_command_stdin.py

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-08-20 Thread Thomas Grainger
Change by Thomas Grainger : -- title: Python doesn't exit with proper resultcode on SIGINT in runpy -> Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module) ___ Python tracker ___