Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r59418:df0c8410ddfc
Date: 2012-12-13 15:07 -0800
http://bitbucket.org/pypy/pypy/changeset/df0c8410ddfc/

Log:    add a bufferstr0_new_w variant

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -1273,6 +1273,14 @@
         buffer = self.buffer_w(w_obj)
         return buffer.as_str()
 
+    def bufferstr0_new_w(self, w_obj):
+        from pypy.rlib import rstring
+        result = self.bufferstr_new_w(w_obj)
+        if '\x00' in result:
+            raise OperationError(self.w_TypeError, self.wrap(
+                    'argument must be a string without NUL characters'))
+        return rstring.assert_str0(result)
+
     def bufferstr_w(self, w_obj):
         # Directly returns an interp-level str.  Note that if w_obj is a
         # unicode string, this is different from str_w(buffer(w_obj)):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to