[New-bugs-announce] [issue41994] Refcount issues in import

Serhiy Storchaka report at bugs.python.org
Sat Oct 10 07:14:48 EDT 2020


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

There is a reference leak in import_add_module(). PyDict_GetItemWithError() returns a borrowed reference, but PyObject_GetItem() return a non-borrowed reference. If sys.modules is not a dict, there is a reference leak. import_add_module() and several other function which return a borrowed reference should be made returning a non-borrowed reference, because there are no guaranties that general mapping keeps reference to value.

It is still not guarantee correctness of PyImport_AddModuleObject().

----------
components: Interpreter Core
messages: 378384
nosy: brett.cannon, eric.snow, ncoghlan, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Refcount issues in import
type: resource usage
versions: Python 3.10, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41994>
_______________________________________


More information about the New-bugs-announce mailing list