[issue30459] PyList_SET_ITEM could be safer

STINNER Victor report at bugs.python.org
Fri Dec 4 20:28:33 EST 2020


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

I propose to merge my PR 23645 change right now. If it breaks too many C extensions, we still have time before Python 3.10.0 final scheduled at Monday, 2021-10-04, to revert the change.


"if (obj == NULL || PyList_SET_ITEM (l, i, obj) < 0)"

Well, this is obviously a bug in py-qt4 and it's a good thing to get a compiler error on such code. I guess that the intent was to use PyList_SetItem().

It's also an issue for Python implementation other than CPython which does not behave exactly like CPython C API. I prefer to fix the C API to make it respect its own documentation (return "void").


Espie Marc: "Well, there is not going to be a lot of breakage. This problem is the only instance I've encountered in the full OpenBSD ports tree."

Oh, thanks for providing this very useful feedback! That's very promising.

Did you report the issue to py-qt4 upstream? If yes, can you please copy here the link to your report?

----------

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


More information about the Python-bugs-list mailing list