diff --git a/kombu/utils/json.py b/kombu/utils/json.py index 9dd03429..a5227467 100644 --- a/kombu/utils/json.py +++ b/kombu/utils/json.py @@ -17,14 +17,11 @@ class JSONEncoder(json.JSONEncoder): def default(self, obj, _super=json.JSONEncoder.default): try: - _super(self, obj) - except TypeError: - try: - reducer = obj.__json__ - except AttributeError: - raise - else: - return reducer() + reducer = obj.__json__ + except AttributeError: + return _super(self, obj) + else: + return reducer() def dumps(s, _dumps=json.dumps, cls=JSONEncoder):