[Python-3000-checkins] r66038 - in python/branches/py3k: Doc/c-api/bytes.rst Doc/c-api/object.rst Include/bytesobject.h Include/object.h Lib/test/test_bytes.py Misc/NEWS Objects/bytesobject.c Objects/object.c

Benjamin Peterson musiccomposition at gmail.com
Wed Aug 27 02:02:21 CEST 2008


On Tue, Aug 26, 2008 at 6:53 PM, Neal Norwitz <nnorwitz at gmail.com> wrote:
> On Tue, Aug 26, 2008 at 9:46 AM, benjamin.peterson
> <python-3000-checkins at python.org> wrote:
>> Modified: python/branches/py3k/Objects/bytesobject.c
>> ==============================================================================
>> --- python/branches/py3k/Objects/bytesobject.c  (original)
>> +++ python/branches/py3k/Objects/bytesobject.c  Tue Aug 26 18:46:47 2008
>> @@ -2924,6 +2923,14 @@
>>                        "encoding or errors without a string argument");
>>                return NULL;
>>        }
>> +        return PyObject_Bytes(x);
>> +}
>> +
>> +PyObject *
>> +PyBytes_FromObject(PyObject *x)
>> +{
>> +       PyObject *new, *it;
>> +       Py_ssize_t i, size;
>>
>>        /* Is it an int? */
>>        size = PyNumber_AsSsize_t(x, PyExc_ValueError);
>
> What happens if x (the object passed in) is NULL?

It segfaults, but this is ok because PyObject_Bytes checks for NULL.

>
> n
> _______________________________________________
> Python-3000-checkins mailing list
> Python-3000-checkins at python.org
> http://mail.python.org/mailman/listinfo/python-3000-checkins
>



-- 
Cheers,
Benjamin Peterson
"There's no place like 127.0.0.1."


More information about the Python-3000-checkins mailing list