[Python-checkins] r46300 - in python/trunk: Lib/socket.py Lib/test/test_socket.py Lib/test/test_struct.py Modules/_struct.c Modules/arraymodule.c Modules/socketmodule.c

Michael Hudson mwh at python.net
Mon May 29 10:04:26 CEST 2006


"Neal Norwitz" <nnorwitz at gmail.com> writes:

>> +static PyObject *
>> +sock_recvfrom_buf(PySocketSockObject *s, PyObject *args, PyObject* kwds)
>
> [...]
>
>> +       readlen = sock_recvfrom_guts(s, buf, recvlen, flags, &addr);
>> +       if (readlen < 0) {
>> +               /* Return an error */
>> +               goto finally;
>> +       }
>> +
>> +       /* Return the number of bytes read and the address.  Note that we do
>> +          not do anything special here in the case that readlen < recvlen. */
>> +       ret = PyTuple_Pack(2, PyInt_FromLong(readlen), addr);
>> +
>> +finally:
>> +       Py_XDECREF(addr);
>> +       return ret;
>
> Why not just do the Tuple_Pack if readlne >= 0?  Hmmm, doesn't this leak a ref?

Something does:

test_socket leaked [1, 1, 1, 1] references
test_urllib2net leaked [1, 1, 1, 1] references

Cheers,
mwh

-- 
     ARTHUR:  Why are there three of you?
  LINTILLAS:  Why is there only one of you?
     ARTHUR:  Er... Could I have notice of that question?
                   -- The Hitch-Hikers Guide to the Galaxy, Episode 11


More information about the Python-checkins mailing list