[pypy-commit] pypy faster-rstruct-2: the Bytebuffer class in rlib.buffer and pypy.module.__pypy__ was almost identical. Kill the latter

antocuni pypy.commits at gmail.com
Mon May 15 11:09:55 EDT 2017


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: faster-rstruct-2
Changeset: r91299:1c9b9bc8492e
Date: 2017-05-15 16:27 +0200
http://bitbucket.org/pypy/pypy/changeset/1c9b9bc8492e/

Log:	the Bytebuffer class in rlib.buffer and pypy.module.__pypy__ was
	almost identical. Kill the latter

diff --git a/pypy/module/__pypy__/bytebuffer.py b/pypy/module/__pypy__/bytebuffer.py
--- a/pypy/module/__pypy__/bytebuffer.py
+++ b/pypy/module/__pypy__/bytebuffer.py
@@ -2,29 +2,8 @@
 # A convenient read-write buffer.  Located here for want of a better place.
 #
 
-from rpython.rlib.buffer import Buffer
+from rpython.rlib.buffer import ByteBuffer
 from pypy.interpreter.gateway import unwrap_spec
-from rpython.rlib.rgc import nonmoving_raw_ptr_for_resizable_list
-
-
-class ByteBuffer(Buffer):
-    _immutable_ = True
-
-    def __init__(self, len):
-        self.data = ['\x00'] * len
-        self.readonly = False
-
-    def getlength(self):
-        return len(self.data)
-
-    def getitem(self, index):
-        return self.data[index]
-
-    def setitem(self, index, char):
-        self.data[index] = char
-
-    def get_raw_address(self):
-        return nonmoving_raw_ptr_for_resizable_list(self.data)
 
 @unwrap_spec(length=int)
 def bytebuffer(space, length):


More information about the pypy-commit mailing list