Author: Ronan Lamy <[email protected]>
Branch: follow_symlinks
Changeset: r83671:4b64950d0558
Date: 2016-04-14 16:30 +0100
http://bitbucket.org/pypy/pypy/changeset/4b64950d0558/
Log: Fall back to the buffer protocol in space.bytes_w()
diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -231,7 +231,8 @@
raise BufferInterfaceNotFound
def bytes_w(self, space):
- self._typed_unwrap_error(space, "bytes")
+ buffer = space.buffer_w(self, space.BUF_FULL_RO)
+ return buffer.as_str()
def unicode_w(self, space):
self._typed_unwrap_error(space, "string")
@@ -398,7 +399,7 @@
self.check_signal_action = None # changed by the signal module
self.user_del_action = UserDelAction(self)
self._code_of_sys_exc_info = None
-
+
# can be overridden to a subclass
self.initialize()
@@ -1537,7 +1538,7 @@
"""
if w_obj is unicode, call identifier_w() (i.e., return the UTF-8
encoded string). Else, call bytes_w().
-
+
Maybe we should kill str_w completely and manually substitute it with
identifier_w/bytes_w at all call sites?
"""
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit