File tree Expand file tree Collapse file tree 2 files changed +2
-14
lines changed
Expand file tree Collapse file tree 2 files changed +2
-14
lines changed Original file line number Diff line number Diff line change 44 MapRegion ,
55 MapRegionList ,
66 is_64_bit ,
7- buffer ,
87)
98
109import sys
@@ -160,7 +159,7 @@ def buffer(self):
160159
161160 **Note:** buffers should not be cached passed the duration of your access as it will
162161 prevent resources from being freed even though they might not be accounted for anymore !"""
163- return buffer (self ._region .buffer (), self ._ofs , self ._size )
162+ return memoryview (self ._region .buffer ())[ self ._ofs : self ._ofs + self . _size ]
164163
165164 def map (self ):
166165 """
Original file line number Diff line number Diff line change 55from mmap import mmap , ACCESS_READ
66from mmap import ALLOCATIONGRANULARITY
77
8- __all__ = ["align_to_mmap" , "is_64_bit" , "buffer" ,
8+ __all__ = ["align_to_mmap" , "is_64_bit" ,
99 "MapWindow" , "MapRegion" , "MapRegionList" , "ALLOCATIONGRANULARITY" ]
1010
1111#{ Utilities
1212
13- try :
14- # Python 2
15- buffer = buffer
16- except NameError :
17- # Python 3 has no `buffer`; only `memoryview`
18- def buffer (obj , offset , size ):
19- # Actually, for gitpython this is fastest ... .
20- return memoryview (obj )[offset :offset + size ]
21- # doing it directly is much faster !
22- # return obj[offset:offset + size]
23-
2413
2514def align_to_mmap (num , round_up ):
2615 """
You can’t perform that action at this time.
0 commit comments