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

Serhiy Storchaka storchaka at gmail.com
Tue Jul 16 23:56:00 CEST 2013


17.07.13 00:09, victor.stinner написав(ла):
> http://hg.python.org/cpython/rev/533eb9ab895a
> changeset:   84669:533eb9ab895a
> user:        Victor Stinner <victor.stinner at gmail.com>
> date:        Tue Jul 16 21:36:02 2013 +0200
> summary:
>    Issue #18408: Fix fileio_read() on _PyBytes_Resize() failure
>
> bytes is NULL on _PyBytes_Resize() failure
>
> files:
>    Modules/_io/fileio.c |  2 +-
>    1 files changed, 1 insertions(+), 1 deletions(-)
>
>
> diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c
> --- a/Modules/_io/fileio.c
> +++ b/Modules/_io/fileio.c
> @@ -739,7 +739,7 @@
>
>       if (n != size) {
>           if (_PyBytes_Resize(&bytes, n) < 0) {
> -            Py_DECREF(bytes);
> +            Py_CLEAR(bytes);
>               return NULL;
>           }
>       }

Why not Py_DECREF?




More information about the Python-Dev mailing list