Skip to content

Commit 04b2c8e

Browse files
committed
Merge pull request #13 from Byron/use_bytes_instead_of_str
Use bytes() instead of str()
2 parents a001174 + 33e6314 commit 04b2c8e

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

smmap/buf.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55

66
__all__ = ["SlidingWindowMapBuffer"]
77

8+
try:
9+
bytes
10+
except NameError:
11+
bytes = str
12+
13+
814
class SlidingWindowMapBuffer(object):
915
"""A buffer like object which allows direct byte-wise object and slicing into
1016
memory of a mapped file. The mapping is controlled by the provided cursor.
@@ -73,7 +79,7 @@ def __getslice__(self, i, j):
7379
ofs = i
7480
# Keeping tokens in a list could possible be faster, but the list
7581
# overhead outweighs the benefits (tested) !
76-
md = str()
82+
md = bytes()
7783
while l:
7884
c.use_region(ofs, l)
7985
assert c.is_valid()

0 commit comments

Comments
 (0)