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;
 }
 
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to