Merge lp:~jelmer/brz/patch-2 into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: 7640
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/patch-2
Merge into: lp:brz
Diff against target: 15 lines (+4/-1)
1 file modified
breezy/plugins/fastimport/cmds.py (+4/-1)
To merge this branch: bzr merge lp:~jelmer/brz/patch-2
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+430055@code.launchpad.net

Commit message

fastimport: Open stdin in binary mode

Description of the change

Open stdin in binary mode

In Python 3 `sys.stdin` is in text mode and `sys.stdin.buffer` needs to be used to get the binary buffer

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/plugins/fastimport/cmds.py'
2--- breezy/plugins/fastimport/cmds.py 2020-06-23 01:02:30 +0000
3+++ breezy/plugins/fastimport/cmds.py 2022-09-17 14:37:50 +0000
4@@ -51,7 +51,10 @@
5 def _get_source_stream(source):
6 if source == '-' or source is None:
7 import sys
8- stream = helpers.binary_stream(sys.stdin)
9+ try:
10+ stream = sys.stdin.buffer
11+ except AttributeError:
12+ stream = helpers.binary_stream(sys.stdin)
13 elif source.endswith('.gz'):
14 import gzip
15 stream = gzip.open(source, "rb")

Subscribers

People subscribed via source and target branches