mercurial/util.py
changeset 30821 7005c03f7387
parent 30798 f50c0db50025
child 30854 0126e422450e
equal deleted inserted replaced
30820:6a70cf94d1b5 30821:7005c03f7387
   236 
   236 
   237 try:
   237 try:
   238     buffer = buffer
   238     buffer = buffer
   239 except NameError:
   239 except NameError:
   240     if not pycompat.ispy3:
   240     if not pycompat.ispy3:
   241         def buffer(sliceable, offset=0):
   241         def buffer(sliceable, offset=0, length=None):
       
   242             if length is not None:
       
   243                 return sliceable[offset:offset + length]
   242             return sliceable[offset:]
   244             return sliceable[offset:]
   243     else:
   245     else:
   244         def buffer(sliceable, offset=0):
   246         def buffer(sliceable, offset=0, length=None):
       
   247             if length is not None:
       
   248                 return memoryview(sliceable)[offset:offset + length]
   245             return memoryview(sliceable)[offset:]
   249             return memoryview(sliceable)[offset:]
   246 
   250 
   247 closefds = pycompat.osname == 'posix'
   251 closefds = pycompat.osname == 'posix'
   248 
   252 
   249 _chunksize = 4096
   253 _chunksize = 4096