[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup

2010-06-14 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Bug related to this issue: #8124, PySys_WriteStdout() and PySys_WriteStderr() ignore signal handlers errors. ... Leave this issue open until #8124 is fixed. I fixed both issues, so it's time to close this one. --

[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup

2010-03-21 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Commited to trunk: r78826 + r78827 Partial backport to 2.6 as r79204: leave import site error handler unchanged (print the error and continue). I don't want to change Python behaviour between minor releases. --

[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup

2010-03-21 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Backported to py3k as r78872 And backported to 3.1 as r79247. But py3k will require extra work: there are some PyErr_Clear() somewhere, eating the errors. Leave this issue open until #8124 is fixed. --

[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup

2010-03-21 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Backported to py3k as r78872 And backported to 3.1 as r79247. I reverted the change on initsite(): as for Python 2.6, I don't want to change import site error handler between minor releases. --

[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup

2010-03-12 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Commited to trunk: r78826 Backported to py3k as r78872. But py3k will require extra work: there are some PyErr_Clear() somewhere, eating the errors. -- ___ Python tracker

[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup

2010-03-12 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Bug related to this issue: #8124, PySys_WriteStdout() and PySys_WriteStderr() ignore signal handlers errors. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3137

[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup

2010-03-10 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Commited to trunk: r78826 + r78827. I will later backport to py3k. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3137 ___

[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup

2010-03-10 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: My change about site initialization error raised 2 old issues: #7774 and #7880. flox commited a fix for #7880 and a workaround for #7774 (just enough to fix test_subprocess). -- ___

[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup

2010-03-08 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: PyImport_Import() clears errors if a module has no globals, whereas PyEval_GetGlobals() doesn't set any exception on failure. = import_no_global.patch removes this unnecessary PyErr_Clear(). --

[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup

2010-03-08 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Py_InitializeEx() calls PyErr_Clear() if PyCodec_Encoder() fails without checking for the exception type. Attached initiliaze_pycodec_error.patch checks for error type: if the error is not an LookupError, display the error and

[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup

2010-03-08 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: tok_stdin_decode() clears error without check for the type. tokenizer_error.patch stops the tokenizer with an E_ERROR if the exception is not an UnicodeDecodeError. Fix also err_input() to support E_ERROR: leave the global

[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup

2010-03-08 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@haypocalc.com: Removed file: http://bugs.python.org/file16489/main_pending_calls.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3137 ___

[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup

2010-03-08 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Remove main_pending_calls.patch hack: replaced by tokenizer_error.patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3137

[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup

2010-03-08 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@haypocalc.com: Added file: http://bugs.python.org/file16493/import_no_global.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3137 ___

[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup

2010-03-08 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Remove main_pending_calls.patch hack: replaced by tokenizer_error.patch. With extra tests, I realized that this patchs is still useful to process a SIGINT emitted between Py_Initialize() and PyRun_AnyFileExFlags(). Without the

[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup

2010-03-08 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: SIGINT.patch is the sum of all patches, it should be easier to review it. -- Added file: http://bugs.python.org/file16499/SIGINT.patch ___ Python tracker rep...@bugs.python.org

[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup

2010-03-08 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: As requested by Guido, here is a new patch including the fix for the site module: catch errors in execsitecustomize() and execusercustomize(). -- Added file: http://bugs.python.org/file16501/SIGINT-2.patch

[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup

2010-03-08 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@haypocalc.com: Removed file: http://bugs.python.org/file16488/initsite.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3137 ___

[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup

2010-03-08 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@haypocalc.com: Removed file: http://bugs.python.org/file16491/initiliaze_pycodec_error.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3137 ___

[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup

2010-03-08 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@haypocalc.com: Removed file: http://bugs.python.org/file16492/tokenizer_error.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3137 ___

[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup

2010-03-08 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@haypocalc.com: Removed file: http://bugs.python.org/file16493/import_no_global.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3137 ___

[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup

2010-03-08 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@haypocalc.com: Removed file: http://bugs.python.org/file16494/main_pending_calls.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3137 ___

[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup

2010-03-08 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@haypocalc.com: Removed file: http://bugs.python.org/file16499/SIGINT.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3137 ___

[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup

2010-03-07 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: I think initsite() should be atomic: if any kind of error occurs, Python should print it and exit directly (exit code 1 to notice the error). If initsite() fails, Python is not complelty initialized. site is responsible to

[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup

2010-03-07 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Using valgrind --log-file=/tmp/trace ./python to slow down Python, I found another bug in the interactive interpreter: if you press CTRL+c just after the initialization of the site module the exception will be ignored. When a

[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup

2008-06-19 Thread Geoffrey Bache
New submission from Geoffrey Bache [EMAIL PROTECTED]: If a python script receives SIGINT while the interpreter is starting up, it's possible to get the message import site failed; use -v for traceback printed on standard error and for execution to proceed. It also seems to be possible to get

[issue3137] Python doesn't handle SIGINT well if it arrives during interpreter startup

2008-06-19 Thread Benjamin Peterson
Benjamin Peterson [EMAIL PROTECTED] added the comment: Yes, the C startup code in pythonrun.c has a lot of bare-except statements. -- nosy: +benjamin.peterson type: - behavior ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3137