Skip to content

Commit 356f493

Browse files
committed
Fix crc32c's __main__ for Python 3
1 parent f0a57a6 commit 356f493

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

kafka/record/_crc32c.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,12 @@ def crc(data):
138138

139139

140140
if __name__ == "__main__":
141+
import six
141142
import sys
142143
# TODO remove the pylint disable once pylint fixes
143144
# https://github.com/PyCQA/pylint/issues/2571
144-
data = sys.stdin.read() # pylint: disable=assignment-from-no-return
145+
if six.PY2:
146+
data = sys.stdin.read() # pylint: disable=assignment-from-no-return
147+
else:
148+
data = sys.stdin.buffer.read() # pylint: disable=assignment-from-no-return
145149
print(hex(crc(data)))

0 commit comments

Comments
 (0)