[pypy-commit] pypy buffer-interface: add buffer interface functions to ArrayBuffer (python array module)
plan_rich
pypy.commits at gmail.com
Wed Aug 31 01:52:51 EDT 2016
Author: Richard Plangger <planrichi at gmail.com>
Branch: buffer-interface
Changeset: r86760:bd907242e194
Date: 2016-08-31 07:52 +0200
http://bitbucket.org/pypy/pypy/changeset/bd907242e194/
Log: add buffer interface functions to ArrayBuffer (python array module)
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
@@ -597,6 +597,18 @@
def getlength(self):
return self.array.len * self.array.itemsize
+ def getformat(self):
+ return self.array.typecode
+
+ def getitemsize(self):
+ return self.array.itemsize
+
+ def getndim(self):
+ return 1
+
+ def getstrides(self):
+ return [self.getitemsize()]
+
def getitem(self, index):
array = self.array
data = array._charbuf_start()
More information about the pypy-commit
mailing list