Skip to content

Commit ecd5041

Browse files
authored
Merge pull request swiftlang#32509 from compnerd/binary-is-not-string
test: make `binary_sub` python 2, 3 compatible
2 parents de8107e + f77e794 commit ecd5041

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/Serialization/Inputs/binary_sub.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,9 @@
55
(_, old, new) = sys.argv
66
assert(len(old) == len(new))
77

8-
data = sys.stdin.read()
9-
sys.stdout.write(data.replace(old, new))
8+
if sys.version_info[0] < 3:
9+
data = sys.stdin.read()
10+
sys.stdout.write(data.replace(old, new))
11+
else:
12+
data = sys.stdin.buffer.read()
13+
sys.stdout.buffer.write(data.replace(old.encode('utf-8'), new.encode('utf-8')))

0 commit comments

Comments
 (0)