Mercurial > public > mercurial-scm > hg-stable
diff mercurial/util.py @ 15657:d976b1ef6760
util: don't mess with builtins to emulate buffer()
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 15 Dec 2011 15:27:11 -0600 |
parents | 4f5a78fa4917 |
children | 7b7f03502b5a |
line wrap: on
line diff
--- a/mercurial/util.py Thu Dec 15 14:59:22 2011 -0600 +++ b/mercurial/util.py Thu Dec 15 15:27:11 2011 -0600 @@ -104,18 +104,15 @@ _fastsha1 = sha1 = _sha1 return _sha1(s) -import __builtin__ - -if sys.version_info[0] < 3: - def fakebuffer(sliceable, offset=0): - return sliceable[offset:] -else: - def fakebuffer(sliceable, offset=0): - return memoryview(sliceable)[offset:] try: - buffer + buffer = buffer except NameError: - __builtin__.buffer = fakebuffer + if sys.version_info[0] < 3: + def buffer(sliceable, offset=0): + return sliceable[offset:] + else: + def buffer(sliceable, offset=0): + return memoryview(sliceable)[offset:] import subprocess closefds = os.name == 'posix'