Commit 63eac159 authored by Guido van Rossum's avatar Guido van Rossum

The NULL pointer for empty strings turns out to be a pain.

At least for the buffer API, return "" in that case.
parent d70539ab
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment