Issue 33330: Better error handling in PyImport_Cleanup() (original) (raw)

Created on 2018-04-22 08:56 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin.

Pull Requests
URL Status Linked Edit
PR 6564 merged serhiy.storchaka,2018-04-22 09:06
PR 6601 merged miss-islington,2018-04-25 17:59
PR 6604 merged serhiy.storchaka,2018-04-25 18:46
PR 6605 merged serhiy.storchaka,2018-04-25 18:47
PR 6606 merged serhiy.storchaka,2018-04-25 18:52
PR 7068 closed vstinner,2018-05-23 09:15
Messages (9)
msg315592 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-04-22 08:56
The proposed PR adds missed checks for errors and PyErr_Clear() calls in PyImport_Cleanup(). It may be worth to use PyErr_WriteUnraisable() in place of PyErr_Clear() (newly added and existing) in most cases. But this can add an unexpected noise, and I don't wont to do this at this stage of 3.7. It could be done in 3.8 though, and backported to 3.7 later. I'm not sure that PyImport_Cleanup() works properly if sys.modules is not a dict. At this stage a custom mapping will likely be broken when most of modules are destroyed.
msg315751 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-04-25 17:58
New changeset e9d9494d6b2a5e0c2d48d22c7f0d5e95504b4f7e by Serhiy Storchaka in branch 'master': bpo-33330: Improve error handling in PyImport_Cleanup(). (GH-6564) https://github.com/python/cpython/commit/e9d9494d6b2a5e0c2d48d22c7f0d5e95504b4f7e
msg315756 - (view) Author: miss-islington (miss-islington) Date: 2018-04-25 18:32
New changeset 291c9d4f74f3c7c57ae18e1aca617206795a090d by Miss Islington (bot) in branch '3.7': bpo-33330: Improve error handling in PyImport_Cleanup(). (GH-6564) https://github.com/python/cpython/commit/291c9d4f74f3c7c57ae18e1aca617206795a090d
msg315757 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-04-25 18:56
PR 6606 replaces PyErr_Clear() with PyErr_WriteUnraisable(). This may add an unexpected noise at shutdown' but on other hand, this may be a helpful information in the case if something wrong happen. It doesn't produce additional output when run all tests, this means that that all is successful. I wonder in which circumstance that output will be occurred.
msg315766 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-04-26 00:27
New changeset b16681fb1e63f45361d1d68333d6dbdd4bf5435d by Serhiy Storchaka in branch '3.6': [3.6] bpo-33330: Improve error handling in PyImport_Cleanup(). (GH-6564). (GH-6604) https://github.com/python/cpython/commit/b16681fb1e63f45361d1d68333d6dbdd4bf5435d
msg315767 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-04-26 00:28
New changeset 55299fffe328c3d2dfc222a22116b7e53bf2e962 by Serhiy Storchaka in branch '2.7': [2.7] bpo-33330: Improve error handling in PyImport_Cleanup(). (GH-6564). (GH-6605) https://github.com/python/cpython/commit/55299fffe328c3d2dfc222a22116b7e53bf2e962
msg315915 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-04-29 19:16
New changeset c1a6832f50b36ffec299e6e6038535904e2b158d by Serhiy Storchaka in branch 'master': bpo-33330: Write exceptions occurred in PyImport_Cleanup() to stderr. (GH-6606) https://github.com/python/cpython/commit/c1a6832f50b36ffec299e6e6038535904e2b158d
msg317367 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-05-23 09:34
I reopen the issue because I created the PR 7068 to propose further checks (in debug mode).
msg317381 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-05-23 10:36
See also about the bug in subinterpreters exposed when add yet one PyErr_WriteUnraisable() in PyImport_Cleanup() (it was not added because of this).
History
Date User Action Args
2022-04-11 14:58:59 admin set github: 77511
2018-05-23 10:36:34 serhiy.storchaka set messages: +
2018-05-23 09:34:43 vstinner set status: closed -> openresolution: fixed -> messages: +
2018-05-23 09:15:46 vstinner set pull_requests: + <pull%5Frequest6696>
2018-05-23 05:36:15 serhiy.storchaka set status: open -> closedresolution: fixedstage: patch review -> resolved
2018-04-29 19:16:33 serhiy.storchaka set messages: +
2018-04-26 00:28:16 serhiy.storchaka set messages: +
2018-04-26 00:27:56 serhiy.storchaka set messages: +
2018-04-25 18:56:28 serhiy.storchaka set messages: +
2018-04-25 18:52:07 serhiy.storchaka set pull_requests: + <pull%5Frequest6302>
2018-04-25 18:47:48 serhiy.storchaka set pull_requests: + <pull%5Frequest6301>
2018-04-25 18:46:56 serhiy.storchaka set pull_requests: + <pull%5Frequest6300>
2018-04-25 18:32:54 miss-islington set nosy: + miss-islingtonmessages: +
2018-04-25 17:59:50 miss-islington set pull_requests: + <pull%5Frequest6296>
2018-04-25 17:58:43 serhiy.storchaka set messages: +
2018-04-22 09:06:02 serhiy.storchaka set keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest6259>
2018-04-22 08:56:30 serhiy.storchaka create