New submission from Oren Milman <ore...@gmail.com>: Various __init__() methods don't decref (if needed) before assigning to fields of the object's struct (i.e. assigning to `self->some_field`): - _asyncio_Task___init___impl() (in Modules/_asynciomodule.c) - _lzma_LZMADecompressor___init___impl() (in Modules/_lzmamodule.c) - _bz2_BZ2Decompressor___init___impl() (in Modules/_bz2module.c) - EVP_tp_init() (in Modules/_hashopenssl.c) - property_init_impl() (in Objects/descrobject.c) - cm_init() (in Objects/funcobject.c) - sm_init() (in Objects/funcobject.c)
For example, _asyncio_Task___init___impl() does `self->task_coro = coro;` instead of `Py_XSETREF(self->task_coro, coro);`. Thus, the following code would result in at least one refleak: import _asyncio task = _asyncio.Task('foo') task.__init__('foo') I would open a PR to fix this soon. ---------- components: Extension Modules messages: 304389 nosy: Oren Milman priority: normal severity: normal status: open title: various refleaks when calling the __init__() method of an object more than once type: resource usage versions: Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31787> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com