commit | 63eac1592700e550d7a8e9b5ef1f77cadac9a020 | [log] [tgz] |
---|---|---|
author | Guido van Rossum <guido@python.org> | Wed May 09 23:36:14 2007 +0000 |
committer | Guido van Rossum <guido@python.org> | Wed May 09 23:36:14 2007 +0000 |
tree | cb49290607519554517e183ed1a2ab45fc69a971 | |
parent | d70539abef79c2ae4ab0c0319a1ee47c10f048dc [diff] [blame] |
The NULL pointer for empty strings turns out to be a pain. At least for the buffer API, return "" in that case.
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 @@ "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; }