equal
deleted
inserted
replaced
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 |