Message378382
There are several issues in remove_module() in Python/import.c.
1. PyMapping_HasKey() is used to determine if the module was in sys.modules before removing it. But it can return 0 not only when the key is absent in the mapping, but also when some exceptions was raised during checking (including MemoryError, KeybordInterraption and RecursionError). The corresponding exception will be silenced and the module will be left in sys.modules.
2. If PyMapping_DelItem() fails, a RuntimeError is raised. It is chained with the exception raised in PyMapping_DelItem(), but the original exception, raised before calling remove_module() will be lost.
3. There is a possible race condition between PyMapping_HasKey() and PyMapping_DelItem(). |
|
Date |
User |
Action |
Args |
2020-10-10 10:51:28 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, brett.cannon, ncoghlan, eric.snow |
2020-10-10 10:51:27 | serhiy.storchaka | set | messageid: <1602327087.97.0.628811045218.issue41993@roundup.psfhosted.org> |
2020-10-10 10:51:27 | serhiy.storchaka | link | issue41993 messages |
2020-10-10 10:51:27 | serhiy.storchaka | create | |
|