Skip to content

Commit 82c97ea

Browse files
committed
Some more adjustments to make it work in all python versions
1 parent 101a4d3 commit 82c97ea

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

smmap/mman.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def buffer(self):
136136
:note: You can only obtain a buffer if this instance is_valid() !
137137
:note: buffers should not be cached passed the duration of your access as it will
138138
prevent resources from being freed even though they might not be accounted for anymore !"""
139-
return buffer(self._region.map(), self._ofs, self._size)
139+
return buffer(self._region.buffer(), self._ofs, self._size)
140140

141141
def map(self):
142142
"""

smmap/util.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def __init__(self, path_or_fd, ofs, size, flags = 0):
136136
self._size = len(self._mf)
137137

138138
if self._need_compat_layer:
139-
self._mfb = buffer(self._mf, ofs, size)
139+
self._mfb = buffer(self._mf, ofs, self._size)
140140
#END handle buffer wrapping
141141
finally:
142142
if isinstance(path_or_fd, basestring):
@@ -148,7 +148,11 @@ def __repr__(self):
148148
return "MapRegion<%i, %i>" % (self._b, self.size())
149149

150150
#{ Interface
151-
151+
152+
def buffer(self):
153+
""":return: a buffer containing the memory"""
154+
return self._mf
155+
152156
def map(self):
153157
""":return: a memory map containing the memory"""
154158
return self._mf

0 commit comments

Comments
 (0)