[New-bugs-announce] [issue33330] Better error handling in PyImport_Cleanup()

Serhiy Storchaka report at bugs.python.org
Sun Apr 22 04:56:30 EDT 2018

New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:

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.

components: Interpreter Core
messages: 315592
nosy: brett.cannon, eric.snow, ncoghlan, pitrou, serhiy.storchaka, vstinner
priority: normal
severity: normal
status: open
title: Better error handling in PyImport_Cleanup()
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list