Commits

Brian Kearns committed 3360556

add getarg('y*'), use instead of bufferstr_w here

Comments (0)

Files changed (3)

pypy/interpreter/baseobjspace.py

             except TypeError:
                 pass
             self._getarg_error("read-write buffer", w_obj)
+        elif code == 'y*':
+            try:
+                return w_obj.buffer_w(self, self.BUF_SIMPLE)
+            except TypeError:
+                self._getarg_error("bytes or buffer", w_obj)
         else:
             assert False
 

pypy/module/_io/interp_bufferedio.py

     def write_w(self, space, w_data):
         self._check_init(space)
         self._check_closed(space, "write to closed file")
-        data = space.bufferstr_w(w_data)
+        data = space.getarg_w('y*', w_data).as_str()
         size = len(data)
 
         with self.lock:

pypy/module/_io/interp_fileio.py

     def write_w(self, space, w_data):
         self._check_closed(space)
         self._check_writable(space)
-        data = space.bufferstr_w(w_data)
+        data = space.getarg_w('y*', w_data).as_str()
 
         try:
             n = os.write(self.fd, data)