Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit33e6314

Browse files
committed
Use bytes() instead of str()
bytes() is more accurate and is actually correct in Python 3, whereasstr() is incorrect in Python 3, because it's a Unicode string.
1 parentc0b94c6 commit33e6314

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎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+
exceptNameError:
11+
bytes=str
12+
13+
814
classSlidingWindowMapBuffer(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
whilel:
7884
c.use_region(ofs,l)
7985
assertc.is_valid()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp