[Python-3000-checkins] r55212 - python/branches/py3k-struni/Objects/bytesobject.c

guido.van.rossum python-3000-checkins at python.org
Thu May 10 01:36:15 CEST 2007


Author: guido.van.rossum
Date: Thu May 10 01:36:14 2007
New Revision: 55212

Modified:
   python/branches/py3k-struni/Objects/bytesobject.c
Log:
The NULL pointer for empty strings turns out to be a pain.
At least for the buffer API, return "" in that case.


Modified: python/branches/py3k-struni/Objects/bytesobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/bytesobject.c	(original)
+++ python/branches/py3k-struni/Objects/bytesobject.c	Thu May 10 01:36:14 2007
@@ -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;
 }
 


More information about the Python-3000-checkins mailing list