| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,7 +4,6 @@ | |||
| 4 | 4 | MapRegion, | |
| 5 | 5 | MapRegionList, | |
| 6 | 6 | is_64_bit, | |
| 7 | - buffer, | ||
| 8 | 7 | ) | |
| 9 | 8 | ||
| 10 | 9 | import sys | |
@@ -160,7 +159,7 @@ def buffer(self): | |||
| 160 | 159 | ||
| 161 | 160 | **Note:** buffers should not be cached passed the duration of your access as it will | |
| 162 | 161 | 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] | ||
| 164 | 163 | ||
| 165 | 164 | def map(self): | |
| 166 | 165 | """ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,22 +5,11 @@ | |||
| 5 | 5 | from mmap import mmap, ACCESS_READ | |
| 6 | 6 | from mmap import ALLOCATIONGRANULARITY | |
| 7 | 7 | ||
| 8 | - __all__ = ["align_to_mmap", "is_64_bit", "buffer", | ||
| 8 | + __all__ = ["align_to_mmap", "is_64_bit", | ||
| 9 | 9 | "MapWindow", "MapRegion", "MapRegionList", "ALLOCATIONGRANULARITY"] | |
| 10 | 10 | ||
| 11 | 11 | #{ Utilities | |
| 12 | 12 | ||
| 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 | - | ||
| 24 | 13 | ||
| 25 | 14 | def align_to_mmap(num, round_up): | |
| 26 | 15 | """ | |
| Back | FazBrowse Home | New Git URL |
0 commit comments