[pypy-commit] pypy refactor-buffer-api: fix usage of bufferstr in cStringIO
bdkearns
noreply at buildbot.pypy.org
Thu Apr 24 22:52:11 CEST 2014
Author: Brian Kearns <bdkearns at gmail.com>
Branch: refactor-buffer-api
Changeset: r70937:a8c7805f00a3
Date: 2014-04-24 16:23 -0400
http://bitbucket.org/pypy/pypy/changeset/a8c7805f00a3/
Log: fix usage of bufferstr in cStringIO
diff --git a/pypy/module/cStringIO/interp_stringio.py b/pypy/module/cStringIO/interp_stringio.py
--- a/pypy/module/cStringIO/interp_stringio.py
+++ b/pypy/module/cStringIO/interp_stringio.py
@@ -160,10 +160,10 @@
raise OperationError(space.w_IOError, space.wrap("negative size"))
self.truncate(size)
- @unwrap_spec(buffer='bufferstr')
- def descr_write(self, buffer):
+ def descr_write(self, space, w_buffer):
+ buffer = space.getarg_w('s*', w_buffer)
self.check_closed()
- self.write(buffer)
+ self.write(buffer.as_str())
def descr_writelines(self, w_lines):
self.check_closed()
@@ -236,5 +236,5 @@
if space.is_none(w_string):
return space.wrap(W_OutputType(space))
else:
- string = space.bufferstr_w(w_string)
+ string = space.getarg_w('s*', w_string).as_str()
return space.wrap(W_InputType(space, string))
diff --git a/pypy/objspace/fake/objspace.py b/pypy/objspace/fake/objspace.py
--- a/pypy/objspace/fake/objspace.py
+++ b/pypy/objspace/fake/objspace.py
@@ -4,7 +4,7 @@
from pypy.interpreter.typedef import TypeDef, GetSetProperty
from pypy.objspace.std.stdtypedef import StdTypeDef
from pypy.objspace.std.sliceobject import W_SliceObject
-from rpython.rlib.buffer import Buffer
+from rpython.rlib.buffer import StringBuffer
from rpython.rlib.objectmodel import instantiate, we_are_translated, specialize
from rpython.rlib.nonconst import NonConstant
from rpython.rlib.rarithmetic import r_uint, r_singlefloat
@@ -41,7 +41,7 @@
is_root(w_subtype)
def buffer_w(self, space, flags):
- return Buffer()
+ return StringBuffer("foobar")
def str_w(self, space):
return NonConstant("foobar")
More information about the pypy-commit
mailing list