[pypy-commit] pypy faster-rstruct-2: move the definition of the class after RawBuffer, which is a base class and thus is better positioned near the top of the file
antocuni
pypy.commits at gmail.com
Mon May 15 11:09:57 EDT 2017
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: faster-rstruct-2
Changeset: r91300:6a3872237846
Date: 2017-05-15 16:28 +0200
http://bitbucket.org/pypy/pypy/changeset/6a3872237846/
Log: move the definition of the class after RawBuffer, which is a base
class and thus is better positioned near the top of the file
diff --git a/rpython/rlib/buffer.py b/rpython/rlib/buffer.py
--- a/rpython/rlib/buffer.py
+++ b/rpython/rlib/buffer.py
@@ -86,27 +86,6 @@
raise CannotWrite
-class ByteBuffer(Buffer):
- _immutable_ = True
-
- def __init__(self, n):
- self.data = resizable_list_supporting_raw_ptr(['\0'] * n)
- 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)
-
-
-
class RawBuffer(Buffer):
"""
A buffer which is baked by a raw, non-movable memory area. It implementes
@@ -138,6 +117,26 @@
return llop.raw_store(lltype.Void, ptr, byte_offset, value)
+class ByteBuffer(Buffer):
+ _immutable_ = True
+
+ def __init__(self, n):
+ self.data = resizable_list_supporting_raw_ptr(['\0'] * n)
+ 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)
+
+
class StringBuffer(Buffer):
_attrs_ = ['readonly', 'value']
_immutable_ = True
More information about the pypy-commit
mailing list