Author: Brian Kearns <[email protected]>
Branch:
Changeset: r70056:56dd1868523c
Date: 2014-03-18 13:45 -0400
http://bitbucket.org/pypy/pypy/changeset/56dd1868523c/
Log: cleanup buffer changes
diff --git a/pypy/module/__builtin__/interp_memoryview.py
b/pypy/module/__builtin__/interp_memoryview.py
--- a/pypy/module/__builtin__/interp_memoryview.py
+++ b/pypy/module/__builtin__/interp_memoryview.py
@@ -44,7 +44,7 @@
@staticmethod
@unwrap_spec(offset=int, size=int)
- def descr_new_buffer(space, w_subtype, w_object, offset=0, size=-1):
+ def descr_new(space, w_subtype, w_object, offset=0, size=-1):
if space.isinstance_w(w_object, space.w_unicode):
# unicode objects support the old buffer interface
# but not the new buffer interface (change in python 2.7)
@@ -145,7 +145,7 @@
start of the object (or at the specified offset). The slice will
extend to the end of the target object (or with the specified size).
""",
- __new__ = interp2app(W_Buffer.descr_new_buffer),
+ __new__ = interp2app(W_Buffer.descr_new),
__len__ = interp2app(W_Buffer.descr_len),
__getitem__ = interp2app(W_Buffer.descr_getitem),
__setitem__ = interp2app(W_Buffer.descr_setitem),
@@ -177,7 +177,7 @@
return self.buf
@staticmethod
- def descr_new_memoryview(space, w_subtype, w_object):
+ def descr_new(space, w_subtype, w_object):
w_memoryview = W_MemoryView(space.buffer_w(w_object))
return w_memoryview
@@ -298,7 +298,7 @@
__doc__ = """\
Create a new memoryview object which references the given object.
""",
- __new__ = interp2app(W_MemoryView.descr_new_memoryview),
+ __new__ = interp2app(W_MemoryView.descr_new),
__eq__ = interp2app(W_MemoryView.descr_eq),
__ge__ = interp2app(W_MemoryView.descr_ge),
__getitem__ = interp2app(W_MemoryView.descr_getitem),
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
@@ -429,7 +429,7 @@
self.handlers = [None] * NB_HANDLERS
- self.buffer_w_ = None
+ self.buffer = None
self.buffer_size = 8192
self.buffer_used = 0
self.w_character_data_handler = None
@@ -541,7 +541,7 @@
def buffer_string(self, space, w_string, length):
ll_length = rffi.cast(lltype.Signed, length)
- if self.buffer_w_ is not None:
+ if self.buffer is not None:
if self.buffer_used + ll_length > self.buffer_size:
self.flush_character_buffer(space)
# handler might have changed; drop the rest on the floor
@@ -549,11 +549,11 @@
if self.w_character_data_handler is None:
return True
if ll_length <= self.buffer_size:
- self.buffer_w_.append(w_string)
+ self.buffer.append(w_string)
self.buffer_used += ll_length
return True
else:
- self.buffer_w_ = []
+ self.buffer = []
self.buffer_used = 0
return False
@@ -685,12 +685,12 @@
return space.wrap(parser)
def flush_character_buffer(self, space):
- if not self.buffer_w_:
+ if not self.buffer:
return
w_data = space.call_function(
space.getattr(space.wrap(''), space.wrap('join')),
- space.newlist(self.buffer_w_))
- self.buffer_w_ = []
+ space.newlist(self.buffer))
+ self.buffer = []
self.buffer_used = 0
if self.w_character_data_handler:
@@ -735,14 +735,14 @@
self.buffer_size = value
def get_buffer_text(self, space):
- return space.wrap(self.buffer_w_ is not None)
+ return space.wrap(self.buffer is not None)
def set_buffer_text(self, space, w_value):
if space.is_true(w_value):
- self.buffer_w_ = []
+ self.buffer = []
self.buffer_used = 0
else:
self.flush_character_buffer(space)
- self.buffer_w_ = None
+ self.buffer = None
def get_intern(self, space):
if self.w_intern:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit