changeset 10756:cb681cc59a8d

util: fake the builtin buffer if it's missing (jython)
author Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
date Tue, 23 Mar 2010 11:36:19 +0100
parents 53313405b54d
children ab3782458827
files mercurial/util.py
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Mon Mar 22 11:08:52 2010 +0100
+++ b/mercurial/util.py	Tue Mar 23 11:36:19 2010 +0100
@@ -36,6 +36,13 @@
     _fastsha1 = sha1 = _sha1
     return _sha1(s)
 
+import __builtin__
+
+def fakebuffer(sliceable, offset=0):
+    return sliceable[offset:]
+if not hasattr(__builtin__, 'buffer'):
+    __builtin__.buffer = fakebuffer
+
 import subprocess
 closefds = os.name == 'posix'