[issue30459] PyList_SET_ITEM could be safer

STINNER Victor report at bugs.python.org
Mon Dec 14 04:56:04 EST 2020


STINNER Victor <vstinner at python.org> added the comment:

> That's not true; at least ALSA's python bindings use PyTuple_SET_ITEM as a lvalue as well.

alsa-python used PyTuple_SET_ITEM(..., obj) to decide if it should call Py_INCREF(obj). This code looks suspicious. PyTuple_SET_ITEM() should not be used to set an item to NULL.

It's already fixed:
https://github.com/alsa-project/alsa-python/commit/5ea2f8709b4d091700750661231f8a3ddce0fc7c

IMO it's a good thing that such suspicious code is discovered. The surprising part is that it worked previously :-)

Downstream Fedora issue: https://bugzilla.redhat.com/show_bug.cgi?id=1906380 (CLOSED)

----------

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


More information about the Python-bugs-list mailing list