diff --git a/kombu/common.py b/kombu/common.py index df882708..a147cf0d 100644 --- a/kombu/common.py +++ b/kombu/common.py @@ -99,10 +99,9 @@ def _maybe_declare(entity): ident = hash(entity) if ident not in declared: entity.declare() - declared.add(entity) + declared.add(hash(entity)) return True return False - entity.declare() return True diff --git a/kombu/tests/test_common.py b/kombu/tests/test_common.py index 7cd1d8b0..1f918297 100644 --- a/kombu/tests/test_common.py +++ b/kombu/tests/test_common.py @@ -80,7 +80,7 @@ class test_maybe_declare(Case): maybe_declare(entity, channel) self.assertEqual(entity.declare.call_count, 1) - self.assertIn(entity, channel.connection.client.declared_entities) + self.assertIn(hash(entity), channel.connection.client.declared_entities) maybe_declare(entity, channel) self.assertEqual(entity.declare.call_count, 1)