[pypy-commit] pypy PyBuffer: Remove __len__ and __getitem__ from Buffer API

rlamy pypy.commits at gmail.com
Sat Apr 1 11:22:54 EDT 2017


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: PyBuffer
Changeset: r90892:a4ec60792800
Date: 2017-04-01 02:26 +0100
http://bitbucket.org/pypy/pypy/changeset/a4ec60792800/

Log:	Remove __len__ and __getitem__ from Buffer API

diff --git a/pypy/interpreter/buffer.py b/pypy/interpreter/buffer.py
--- a/pypy/interpreter/buffer.py
+++ b/pypy/interpreter/buffer.py
@@ -11,11 +11,6 @@
         """Returns the size in bytes (even if getitemsize() > 1)."""
         raise NotImplementedError
 
-    def __len__(self):
-        res = self.getlength()
-        assert res >= 0
-        return res
-
     def as_str(self):
         "Returns an interp-level string with the whole content of the buffer."
         return ''.join(self._copy_buffer())
@@ -24,9 +19,6 @@
         "Returns the index'th character in the buffer."
         raise NotImplementedError   # Must be overriden.  No bounds checks.
 
-    def __getitem__(self, i):
-        return self.getitem(i)
-
     def getslice(self, start, stop, step, size):
         # May be overridden.  No bounds checks.
         return ''.join([self.getitem(i) for i in range(start, stop, step)])


More information about the pypy-commit mailing list