summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Objects/bytesobject.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index a07f9e7..2cdaf37 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -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;
}