Re: [Python-Dev] cpython: Issue #18408: Fix fileio_read() on _PyBytes_Resize() failure

2013/7/17 Serhiy Storchaka <storchaka@gmail.com>:
Oh, I meaned Py_XDECREF.
Ah ok :-) Well, for this specific code, it can probably be replaced with: if (_PyBytes_Resize(&bytes, n) < 0) return NULL; I'm not sure that _PyBytes_Resize() *always* decref bytes and then set bytes to NULL. I was too lazy to check this. If someone wants to audit the code of _PyBytes_Resize(), there are many other places where Py_XDECREF / Py_CLEAR can be removed on _PyBytes_Resize() failure. And I'm quite sure that there are still places where Py_DECREF() is still used on _PyBytes_Resize() failure ;-) Victor

2013/7/17 Serhiy Storchaka <storchaka@gmail.com>:
Oh, I meaned Py_XDECREF.
Ah ok :-) Well, for this specific code, it can probably be replaced with: if (_PyBytes_Resize(&bytes, n) < 0) return NULL; I'm not sure that _PyBytes_Resize() *always* decref bytes and then set bytes to NULL. I was too lazy to check this. If someone wants to audit the code of _PyBytes_Resize(), there are many other places where Py_XDECREF / Py_CLEAR can be removed on _PyBytes_Resize() failure. And I'm quite sure that there are still places where Py_DECREF() is still used on _PyBytes_Resize() failure ;-) Victor
participants (3)
-
Christian Heimes
-
Serhiy Storchaka
-
Victor Stinner