Skip to content

Commit c4a6e1a

Browse files
committed
Use six.string_types for topic type check in dpkp#824
1 parent 5ad6f52 commit c4a6e1a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kafka/consumer/subscription_state.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,15 @@ def change_subscription(self, topics):
133133
if self._user_assignment:
134134
raise IllegalStateError(self._SUBSCRIPTION_EXCEPTION_MESSAGE)
135135

136-
if isinstance(topics, str):
136+
if isinstance(topics, six.string_types):
137137
topics = [topics]
138138

139139
if self.subscription == set(topics):
140140
log.warning("subscription unchanged by change_subscription(%s)",
141141
topics)
142142
return
143143

144-
if any(not isinstance(t, str) for t in topics):
144+
if any(not isinstance(t, six.string_types) for t in topics):
145145
raise TypeError('All topics must be strings')
146146

147147
log.info('Updating subscribed topics to: %s', topics)

0 commit comments

Comments
 (0)