Skip to content

Commit 41966dd

Browse files
committed
python2 fixups (#2655)
1 parent 0e1a5bc commit 41966dd

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

kafka/consumer/fetcher.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,8 @@ def _fetchable_partitions(self):
613613
fetchable = self._subscriptions.fetchable_partitions()
614614
# do not fetch a partition if we have a pending fetch response to process
615615
# use copy.copy to avoid runtimeerror on mutation from different thread
616-
discard = {fetch.topic_partition for fetch in self._completed_fetches.copy()}
616+
# TODO: switch to deque.copy() with py3
617+
discard = {fetch.topic_partition for fetch in copy.copy(self._completed_fetches)}
617618
current = self._next_partition_records
618619
if current:
619620
discard.add(current.topic_partition)

kafka/sasl/gssapi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ def receive(self, auth_bytes):
6868
# simply set QoP to 'auth' only (first octet). We reuse the max message size proposed
6969
# by the server
7070
client_flags = self.SASL_QOP_AUTH
71-
server_flags = msg[0]
71+
server_flags = struct.Struct('>b').unpack(msg[0:1])[0]
7272
message_parts = [
7373
struct.Struct('>b').pack(client_flags & server_flags),
74-
msg[1:],
74+
msg[1:], # always agree to max message size from server
7575
self.auth_id.encode('utf-8'),
7676
]
7777
# add authorization identity to the response, and GSS-wrap

0 commit comments

Comments
 (0)