util: use fakebuffer as buffer in py3k
There's no buffer type in py3k, util.py has a function, called
fakebuffer, that implements a similar API. This patch implements
fakebuffer as a memoryview wrapper in py3k.
--- a/mercurial/util.py Wed Jul 14 22:59:43 2010 -0300
+++ b/mercurial/util.py Wed Jul 14 22:59:57 2010 -0300
@@ -38,8 +38,12 @@
import __builtin__
-def fakebuffer(sliceable, offset=0):
- return sliceable[offset:]
+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
except NameError: