[pypy-commit] pypy PyBuffer: space.bufferstr_w() with a single argument is just space.charbuf_w()
rlamy
pypy.commits at gmail.com
Thu Apr 20 22:25:17 EDT 2017
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: PyBuffer
Changeset: r91106:97530758eddd
Date: 2017-04-21 03:24 +0100
http://bitbucket.org/pypy/pypy/changeset/97530758eddd/
Log: space.bufferstr_w() with a single argument is just space.charbuf_w()
diff --git a/pypy/interpreter/gateway.py b/pypy/interpreter/gateway.py
--- a/pypy/interpreter/gateway.py
+++ b/pypy/interpreter/gateway.py
@@ -303,7 +303,7 @@
% (self.scopenext(), ))
def visit_bufferstr(self, typ):
- self.run_args.append("space.bufferstr_w(%s)" % (self.scopenext(),))
+ self.run_args.append("space.charbuf_w(%s)" % (self.scopenext(),))
def visit_text_or_none(self, typ):
self.run_args.append("space.text_or_none_w(%s)" % (self.scopenext(),))
diff --git a/pypy/module/_socket/interp_socket.py b/pypy/module/_socket/interp_socket.py
--- a/pypy/module/_socket/interp_socket.py
+++ b/pypy/module/_socket/interp_socket.py
@@ -482,7 +482,7 @@
Like send(data, flags) but allows specifying the destination address.
For IP sockets, the address is a pair (hostaddr, port).
"""
- data = space.bufferstr_w(w_data)
+ data = space.charbuf_w(w_data)
if w_param3 is None:
# 2 args version
flags = 0
diff --git a/pypy/module/_sre/interp_sre.py b/pypy/module/_sre/interp_sre.py
--- a/pypy/module/_sre/interp_sre.py
+++ b/pypy/module/_sre/interp_sre.py
@@ -468,7 +468,7 @@
# Type check
if not (space.is_none(w_pattern) or
space.isinstance_w(w_pattern, space.w_unicode)):
- space.bufferstr_w(w_pattern)
+ space.readbuf_w(w_pattern)
srepat.w_pattern = w_pattern # the original uncompiled pattern
srepat.flags = flags
srepat.code = code
diff --git a/pypy/module/array/interp_array.py b/pypy/module/array/interp_array.py
--- a/pypy/module/array/interp_array.py
+++ b/pypy/module/array/interp_array.py
@@ -59,7 +59,7 @@
a.descr_fromlist(space, w_initializer)
else:
try:
- buf = space.bufferstr_w(w_initializer)
+ buf = space.charbuf_w(w_initializer)
except OperationError as e:
if not e.match(space, space.w_TypeError):
raise
diff --git a/pypy/module/binascii/interp_binascii.py b/pypy/module/binascii/interp_binascii.py
--- a/pypy/module/binascii/interp_binascii.py
+++ b/pypy/module/binascii/interp_binascii.py
@@ -20,5 +20,5 @@
def unwrap(self, space, w_value):
if space.isinstance_w(w_value, space.w_unicode):
w_value = space.call_method(w_value, "encode", space.newtext("ascii"))
- return space.bufferstr_w(w_value)
+ return space.charbuf_w(w_value)
diff --git a/pypy/module/exceptions/interp_exceptions.py b/pypy/module/exceptions/interp_exceptions.py
--- a/pypy/module/exceptions/interp_exceptions.py
+++ b/pypy/module/exceptions/interp_exceptions.py
@@ -894,7 +894,7 @@
def descr_init(self, space, w_encoding, w_object, w_start, w_end, w_reason):
# typechecking
if space.isinstance_w(w_object, space.w_bytearray):
- w_bytes = space.newbytes(space.bufferstr_w(w_object))
+ w_bytes = space.newbytes(space.charbuf_w(w_object))
else:
w_bytes = w_object
space.realtext_w(w_encoding)
diff --git a/pypy/module/operator/tscmp.py b/pypy/module/operator/tscmp.py
--- a/pypy/module/operator/tscmp.py
+++ b/pypy/module/operator/tscmp.py
@@ -57,8 +57,8 @@
def compare_digest_buffer(space, w_a, w_b):
- a = space.bufferstr_w(w_a)
- b = space.bufferstr_w(w_b)
+ a = space.charbuf_w(w_a)
+ b = space.charbuf_w(w_b)
with rffi.scoped_nonmovingbuffer(a) as a_buf:
with rffi.scoped_nonmovingbuffer(b) as b_buf:
result = pypy_tscmp(a_buf, b_buf, len(a), len(b))
diff --git a/pypy/module/pyexpat/interp_pyexpat.py b/pypy/module/pyexpat/interp_pyexpat.py
--- a/pypy/module/pyexpat/interp_pyexpat.py
+++ b/pypy/module/pyexpat/interp_pyexpat.py
@@ -644,7 +644,7 @@
# Explicitly set UTF-8 encoding. Return code ignored.
XML_SetEncoding(self.itself, "utf-8")
else:
- data = space.bufferstr_w(w_data)
+ data = space.charbuf_w(w_data)
isfinal = bool(isfinal)
res = XML_Parse(self.itself, data, len(data), isfinal)
if self._exc_info:
diff --git a/pypy/module/zlib/interp_zlib.py b/pypy/module/zlib/interp_zlib.py
--- a/pypy/module/zlib/interp_zlib.py
+++ b/pypy/module/zlib/interp_zlib.py
@@ -202,7 +202,7 @@
if space.is_none(w_zdict):
zdict = None
else:
- zdict = space.bufferstr_w(w_zdict)
+ zdict = space.charbuf_w(w_zdict)
stream = space.allocate_instance(Compress, w_subtype)
stream = space.interp_w(Compress, stream)
Compress.__init__(stream, space, level,
@@ -330,7 +330,7 @@
if space.is_none(w_zdict):
zdict = None
else:
- zdict = space.bufferstr_w(w_zdict)
+ zdict = space.charbuf_w(w_zdict)
stream = space.allocate_instance(Decompress, w_subtype)
stream = space.interp_w(Decompress, stream)
Decompress.__init__(stream, space, wbits, zdict)
diff --git a/pypy/objspace/std/intobject.py b/pypy/objspace/std/intobject.py
--- a/pypy/objspace/std/intobject.py
+++ b/pypy/objspace/std/intobject.py
@@ -875,7 +875,7 @@
elif (space.isinstance_w(w_value, space.w_bytearray) or
space.isinstance_w(w_value, space.w_bytes)):
return _string_to_int_or_long(space, w_inttype, w_value,
- space.bufferstr_w(w_value))
+ space.charbuf_w(w_value))
else:
# If object supports the buffer interface
try:
@@ -901,7 +901,7 @@
s = unicode_to_decimal_w(space, w_value, allow_surrogates=True)
elif (space.isinstance_w(w_value, space.w_bytes) or
space.isinstance_w(w_value, space.w_bytearray)):
- s = space.bufferstr_w(w_value)
+ s = space.charbuf_w(w_value)
else:
raise oefmt(space.w_TypeError,
"int() can't convert non-string with explicit base")
More information about the pypy-commit
mailing list