This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: regrtest: log unraisable exceptions and uncaught thread exceptions
Type: Stage: resolved
Components: Tests Versions: Python 3.8
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: vstinner
Priority: normal Keywords: patch

Created on 2019-05-27 22:51 by vstinner, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 13759 merged vstinner, 2019-06-02 23:49
PR 13762 merged vstinner, 2019-06-03 00:34
Messages (6)
msg343693 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-05-27 22:51
Python 3.8 got 2 new hooks: sys.unraisablehook and threading.excepthook. It would be interesting to catch these exceptions and display them again in the test summary.

I modified the io.IOBase destructor to log close() exception. There are still open issues: see bpo-18748. Once these issues will be fixed, maybe it would even be interesting to make a test fail if at least one uncaught thread exception is raised or an unraisable exception is logged?
msg343696 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-05-27 22:54

* bpo-36829: sys.unraisablehook()
* bpo-1230540: threading.excepthook()
msg344341 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-06-03 00:00
I wrote a minimum implementation: PR 13759 marks a test as "altered the execution environment" (ENV_CHANGED) if sys.unraisablehook() is called at least once. This this PR, 9 tests fail:

* test_urllib: see bpo-36918
* test_io: see bpo-18748

* test_thread: test_save_exception_state_on_error()
* test_yield_from: test_broken_getattr_handling()
* test_coroutines: test_fatal_coro_warning()
* test_cprofile: test_bad_counter_during_dealloc()
* test_raise: test_3611()
* test_ssl: test_sni_callback_raising() and test_sni_callback_wrong_return_type()

* test_generators: I'm not sure, it's maybe caused by doctests? multiple tests?
msg344365 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-06-03 01:51
New changeset 0025350294959594e7f57aef4fc9579c77a0ed1c by Victor Stinner in branch 'master':
bpo-37069: tests use catch_unraisable_exception() (GH-13762)
msg345425 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-06-12 23:09
New changeset 95f61c8b1619e736bd5e29a0da0183234634b6e8 by Victor Stinner in branch 'master':
bpo-37069: regrtest uses sys.unraisablehook (GH-13759)
msg348705 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-07-29 23:50
regrtest now uses :func:`sys.unraisablehook` to mark a test as "environment altered" (ENV_CHANGED) if it emits an "unraisable exception".
Date User Action Args
2022-04-11 14:59:15adminsetgithub: 81250
2019-07-29 23:50:33vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg348705

stage: patch review -> resolved
2019-06-12 23:09:07vstinnersetmessages: + msg345425
2019-06-03 01:51:45vstinnersetmessages: + msg344365
2019-06-03 00:34:28vstinnersetpull_requests: + pull_request13647
2019-06-03 00:00:46vstinnersetmessages: + msg344341
2019-06-02 23:49:06vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request13644
2019-05-27 22:54:53vstinnersetmessages: + msg343696
2019-05-27 22:51:24vstinnercreate