mirror of https://github.com/python/cpython
The NULL pointer for empty strings turns out to be a pain.
At least for the buffer API, return "" in that case.
This commit is contained in:
parent
d70539abef
commit
63eac15927
|
@ -950,7 +950,10 @@ bytes_getbuffer(PyBytesObject *self, Py_ssize_t index, const void **ptr)
|
|||
"accessing non-existent bytes segment");
|
||||
return -1;
|
||||
}
|
||||
*ptr = (void *)self->ob_bytes;
|
||||
if (self->ob_bytes == NULL)
|
||||
*ptr = "";
|
||||
else
|
||||
*ptr = self->ob_bytes;
|
||||
return self->ob_size;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue