STINNER Victor <vstin...@redhat.com> added the comment:

> The point for me is that CI will fail if it happens, then I can use gdb to 
> find out the cause

I'm not comfortable with forcing users to use a low-level debugger to debug 
"unraisable exceptions".

I tried PR 13175 on the test suite by forcing the option to 1: always call 
Py_FatalError(). Many tests break:

14 tests failed:
    test_asyncio test_cmd_line test_coroutines test_cprofile
    test_exceptions test_generators test_import test_io
    test_raise test_repl test_signal test_ssl test_urllib
    test_yield_from

Examples:

test_error_through_destructor (test.test_io.CBufferedReaderTest) ... Fatal 
Python error: Unraisable exception

FAIL: test_warn_on_full_buffer (test.test_signal.WakeupSocketSignalTests)
FAIL: test_send_error (test.test_signal.WakeupSocketSignalTests)
FAIL: test_wakeup_write_error (test.test_signal.WakeupSignalTests)

test_unraisable (test.test_exceptions.ExceptionTests) ... Fatal Python error: 
Unraisable exception

test_generators:

Trying:
    del g
Expecting nothing
Fatal Python error: Unraisable exception

etc.

Unraisable exceptions are bad, but it's really hard to fix all of them. They 
are too many cases where Python is unable to pass exceptions to the parent.

If you want to make the situation better, maybe we should investigate where 
Python cannot raise exceptions and try to make it possible.

IMHO my PR 13187 adding sys.unraisablehook() is more usable/reasonable option.

--

Thomas Grainger: which code are you running on your CI? Did you try PR 13175 on 
your CI? Try it with this additional change, to always crash on 
PyErr_WriteUnraisable(). Does your CI still pass?

diff --git a/Include/cpython/coreconfig.h b/Include/cpython/coreconfig.h
index 375c0b641d..a775584553 100644
--- a/Include/cpython/coreconfig.h
+++ b/Include/cpython/coreconfig.h
@@ -426,7 +426,8 @@ typedef struct {
         .buffered_stdio = -1, \
         ._install_importlib = 1, \
         .check_hash_pycs_mode = NULL, \
-        ._frozen = -1}
+        ._frozen = -1, \
+        .abort_unraisable = 1}
 /* Note: _PyCoreConfig_INIT sets other fields to 0/NULL */
 
 #ifdef __cplusplus

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36829>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to