[pypy-commit] pypy default: since we're read only, don't do a copy when we don't have to

fijal noreply at buildbot.pypy.org
Fri Jul 24 14:59:13 CEST 2015


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: 
Changeset: r78655:1c1bafcc37b9
Date: 2015-07-24 14:58 +0200
http://bitbucket.org/pypy/pypy/changeset/1c1bafcc37b9/

Log:	since we're read only, don't do a copy when we don't have to

diff --git a/rpython/rlib/buffer.py b/rpython/rlib/buffer.py
--- a/rpython/rlib/buffer.py
+++ b/rpython/rlib/buffer.py
@@ -74,6 +74,8 @@
             return ""
         if step == 1:
             assert 0 <= start <= stop
+            if start == 0 and stop == len(self.value):
+                return self.value
             return self.value[start:stop]
         return Buffer.getslice(self, start, stop, step, size)
 


More information about the pypy-commit mailing list