diff mercurial/util.py @ 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 7a6b5f85c3ab
children ef3668450cd0
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'