[issue41103] Removing old buffer support

STINNER Victor report at bugs.python.org
Wed Nov 25 16:24:44 EST 2020


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

PyObject_AsCharBuffer() is dangerous: it returns a dangling pointer by design. PyObject_GetBuffer() design is safer: the API ensures that the buffer remains valid until PyBuffer_Release() is called.

PyQt5 was updated to use the safe PyObject_GetBuffer()/PyBuffer_Release(). PyQt4 is no longer updated, that's why I proposed a downstream fix which copy/paste the old code. Changing PyQt4 to use the safe API was not worth it, since it's complex to redesign the impacted function qpycore_encode().

----------

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


More information about the Python-bugs-list mailing list