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

Make sure .read() and friends always return bytes#405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Byron merged 2 commits intogitpython-developers:masterfromnvie:master
Apr 10, 2016
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletionsgit/cmd.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -355,7 +355,7 @@ def __init__(self, size, stream):
def read(self, size=-1):
bytes_left = self._size - self._nbr
if bytes_left == 0:
return ''
returnb''
if size > -1:
# assure we don't try to read past our limit
size = min(bytes_left, size)
Expand All@@ -374,7 +374,7 @@ def read(self, size=-1):

def readline(self, size=-1):
if self._nbr == self._size:
return ''
returnb''

# clamp size to lowest allowed value
bytes_left = self._size - self._nbr
Expand Down
6 changes: 3 additions & 3 deletionsgit/test/test_repo.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -454,7 +454,7 @@ def mktiny():
assert s.readline() == l1
assert s.readline() == l2
assert s.readline() == l3
assert s.readline() == ''
assert s.readline() ==b''
assert s._stream.tell() == len(d)

# readline limit
Expand All@@ -465,13 +465,13 @@ def mktiny():
# readline on tiny section
s = mktiny()
assert s.readline() == l1p
assert s.readline() == ''
assert s.readline() ==b''
assert s._stream.tell() == ts + 1

# read no limit
s = mkfull()
assert s.read() == d[:-1]
assert s.read() == ''
assert s.read() ==b''
assert s._stream.tell() == len(d)

# read limit
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp