summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Abramowitz <msabramo@gmail.com>2014-06-16 09:41:22 -0700
committerMarc Abramowitz <msabramo@gmail.com>2014-06-16 09:41:22 -0700
commit04b2c8e0025e910010b49fd076327b869fcb859b (patch)
tree7f56b57f1ef921e64c9fa2595764cb05bf9effac
parenta00117481ae16124db6f160121722b88dc507412 (diff)
parent33e6314941572a93b8031b1feecded22ef1f5f3c (diff)
downloadsmmap-04b2c8e0025e910010b49fd076327b869fcb859b.tar.gz
Merge pull request #13 from Byron/use_bytes_instead_of_str
Use bytes() instead of str()
-rw-r--r--smmap/buf.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/smmap/buf.py b/smmap/buf.py
index 3917ee8..ba6f8ed 100644
--- a/smmap/buf.py
+++ b/smmap/buf.py
@@ -5,6 +5,12 @@ import sys
__all__ = ["SlidingWindowMapBuffer"]
+try:
+ bytes
+except NameError:
+ bytes = str
+
+
class SlidingWindowMapBuffer(object):
"""A buffer like object which allows direct byte-wise object and slicing into
memory of a mapped file. The mapping is controlled by the provided cursor.
@@ -73,7 +79,7 @@ class SlidingWindowMapBuffer(object):
ofs = i
# Keeping tokens in a list could possible be faster, but the list
# overhead outweighs the benefits (tested) !
- md = str()
+ md = bytes()
while l:
c.use_region(ofs, l)
assert c.is_valid()