Author Oren Milman
Recipients Oren Milman
Date 2017-10-14.09:16:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1507972588.41.0.213398074469.issue31787@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-10-14 09:16:28Oren Milmansetrecipients: + Oren Milman
2017-10-14 09:16:28Oren Milmansetmessageid: <1507972588.41.0.213398074469.issue31787@psf.upfronthosting.co.za>
2017-10-14 09:16:28Oren Milmanlinkissue31787 messages
2017-10-14 09:16:27Oren Milmancreate