util: fake the builtin buffer if it's missing (jython)
authorRonny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
Tue, 23 Mar 2010 11:36:19 +0100
changeset 10756 cb681cc59a8d
parent 10752 53313405b54d
child 10757 ab3782458827
util: fake the builtin buffer if it's missing (jython)
mercurial/util.py
--- 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'