diff --git a/pika/connection.py b/pika/connection.py index 89475fc70..a8e446550 100644 --- a/pika/connection.py +++ b/pika/connection.py @@ -1029,7 +1029,8 @@ def _has_open_channels(self): :rtype: bool """ - return any([self._channels[num].is_open for num in self._channels]) + return any([self._channels[num].is_open for num in + self._channels.keys()]) def _has_pending_callbacks(self, value): """Return true if there are any callbacks pending for the specified