Author graingert
Recipients ZackerySpytz, graingert, matrixise, serhiy.storchaka, vstinner
Date 2019-05-09.23:50:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CABnLcR6Qg2Vfs1TtqYGdg8TiHX2f62akpv9aHFrggKLxpT2sYQ@mail.gmail.com>
In-reply-to <1557445330.16.0.294383981969.issue36829@roundup.psfhosted.org>
Content
> I'm not comfortable with forcing users to use a low-level debugger to
debug "unraisable exceptions".

Defaulting to noop when the hook fails means I'll never notice the failure
to be able to debug it

On Fri, 10 May 2019, 00:42 STINNER Victor, <report@bugs.python.org> wrote:

>
> STINNER Victor <vstinner@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 <report@bugs.python.org>
> <https://bugs.python.org/issue36829>
> _______________________________________
>
History
Date User Action Args
2019-05-09 23:50:23graingertsetrecipients: + graingert, vstinner, serhiy.storchaka, matrixise, ZackerySpytz
2019-05-09 23:50:23graingertlinkissue36829 messages
2019-05-09 23:50:23graingertcreate