Skip to content

Commit 27da916

Browse files
asdaraujojeffwidman
authored andcommitted
Fix two bugs in printing bytes instance
Bug 1: When `value` is None, trying to call `len(None)` throws an exception. Bug 2: When len(`value`) <= 100, the code currently prints b'' rather than `value`.
1 parent 16e05e7 commit 27da916

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kafka/protocol/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def decode(cls, data):
100100

101101
@classmethod
102102
def repr(cls, value):
103-
return repr(value[:100] + b'...' if len(value) > 100 else b'')
103+
return repr(value[:100] + b'...' if value is not None and len(value) > 100 else value)
104104

105105

106106
class Boolean(AbstractType):

0 commit comments

Comments
 (0)