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

2013-07-16 Thread Victor Stinner
2013/7/17 Serhiy Storchaka : > 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

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

2013-07-16 Thread Christian Heimes
Am 17.07.2013 00:03, schrieb Victor Stinner: > 2013/7/16 Serhiy Storchaka : >>> http://hg.python.org/cpython/rev/533eb9ab895a >>> summary: >>>Issue #18408: Fix fileio_read() on _PyBytes_Resize() failure >>> >>> bytes is NULL on _PyBytes_Resize() failure >> >> Why not Py_DECREF? > > Because Py_

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

2013-07-16 Thread Serhiy Storchaka
17.07.13 01:03, Victor Stinner написав(ла): 2013/7/16 Serhiy Storchaka : http://hg.python.org/cpython/rev/533eb9ab895a summary: Issue #18408: Fix fileio_read() on _PyBytes_Resize() failure bytes is NULL on _PyBytes_Resize() failure Why not Py_DECREF? Because Py_DECREF(NULL) does crash.

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

2013-07-16 Thread Victor Stinner
2013/7/16 Serhiy Storchaka : >> http://hg.python.org/cpython/rev/533eb9ab895a >> summary: >>Issue #18408: Fix fileio_read() on _PyBytes_Resize() failure >> >> bytes is NULL on _PyBytes_Resize() failure > > Why not Py_DECREF? Because Py_DECREF(NULL) does crash. Victor _

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

2013-07-16 Thread Serhiy Storchaka
17.07.13 00:09, victor.stinner написав(ла): http://hg.python.org/cpython/rev/533eb9ab895a changeset: 84669:533eb9ab895a user:Victor Stinner date:Tue Jul 16 21:36:02 2013 +0200 summary: Issue #18408: Fix fileio_read() on _PyBytes_Resize() failure bytes is NULL on _PyBytes_Re