Author: Brian Kearns <[email protected]>
Branch:
Changeset: r71256:ab7d9bdd72c7
Date: 2014-05-04 02:34 -0400
http://bitbucket.org/pypy/pypy/changeset/ab7d9bdd72c7/
Log: replace some usages of bufferstr
diff --git a/pypy/module/mmap/interp_mmap.py b/pypy/module/mmap/interp_mmap.py
--- a/pypy/module/mmap/interp_mmap.py
+++ b/pypy/module/mmap/interp_mmap.py
@@ -40,10 +40,10 @@
self.check_valid()
return self.space.wrap(self.mmap.read(num))
- @unwrap_spec(tofind='bufferstr')
- def find(self, tofind, w_start=None, w_end=None):
+ def find(self, w_tofind, w_start=None, w_end=None):
self.check_valid()
space = self.space
+ tofind = space.getarg_w('s#', w_tofind)
if w_start is None:
start = self.mmap.pos
else:
@@ -54,10 +54,10 @@
end = space.getindex_w(w_end, None)
return space.wrap(self.mmap.find(tofind, start, end))
- @unwrap_spec(tofind='bufferstr')
- def rfind(self, tofind, w_start=None, w_end=None):
+ def rfind(self, w_tofind, w_start=None, w_end=None):
self.check_valid()
space = self.space
+ tofind = space.getarg_w('s#', w_tofind)
if w_start is None:
start = self.mmap.pos
else:
@@ -87,9 +87,9 @@
except OSError, e:
raise mmap_error(self.space, e)
- @unwrap_spec(data='bufferstr')
- def write(self, data):
+ def write(self, w_data):
self.check_valid()
+ data = self.space.getarg_w('s#', w_data)
self.check_writeable()
try:
self.mmap.write(data)
diff --git a/pypy/module/posix/interp_posix.py
b/pypy/module/posix/interp_posix.py
--- a/pypy/module/posix/interp_posix.py
+++ b/pypy/module/posix/interp_posix.py
@@ -142,12 +142,13 @@
else:
return space.wrap(s)
-@unwrap_spec(fd=c_int, data='bufferstr')
-def write(space, fd, data):
+@unwrap_spec(fd=c_int)
+def write(space, fd, w_data):
"""Write a string to a file descriptor. Return the number of bytes
actually written, which may be smaller than len(data)."""
+ data = space.getarg_w('s*', w_data)
try:
- res = os.write(fd, data)
+ res = os.write(fd, data.as_str())
except OSError, e:
raise wrap_oserror(space, e)
else:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit