Author: Brian Kearns <[email protected]>
Branch: refactor-buffer-api
Changeset: r70913:33a8fc69f913
Date: 2014-04-23 21:54 -0400
http://bitbucket.org/pypy/pypy/changeset/33a8fc69f913/
Log: kill bufferchar_w
diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -1431,7 +1431,7 @@
else:
assert False
- # XXX rename these/replace with code more like CPython getargs for buffers
+ # XXX rename/replace with code more like CPython getargs for buffers
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)):
@@ -1455,14 +1455,6 @@
self._getarg_error("string or buffer", w_obj)
return buf.as_str()
- def bufferchar_w(self, w_obj):
- try:
- return self.str_w(w_obj)
- except OperationError, e:
- if not e.match(self, self.w_TypeError):
- raise
- return self.charbuf_w(w_obj)
-
def str_or_None_w(self, w_obj):
if self.is_w(w_obj, self.w_None):
return None
diff --git a/pypy/objspace/std/bytesobject.py b/pypy/objspace/std/bytesobject.py
--- a/pypy/objspace/std/bytesobject.py
+++ b/pypy/objspace/std/bytesobject.py
@@ -477,8 +477,14 @@
def _val(self, space):
return self._value
- def _op_val(self, space, w_other):
- return space.bufferchar_w(w_other)
+ @staticmethod
+ def _op_val(space, w_other):
+ try:
+ return space.str_w(w_other)
+ except OperationError, e:
+ if not e.match(space, space.w_TypeError):
+ raise
+ return space.charbuf_w(w_other)
def _chr(self, char):
assert len(char) == 1
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit