From 4884c74625c1fec7fe2315cbb2ea50b4d0cc991b Mon Sep 17 00:00:00 2001 From: Jan Pokorný Date: Mon, 13 Jul 2015 23:00:38 +0200 Subject: format: avoid duplicate "swallow" (+validation, ...) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also fixes assertion error for two equal (but non-identical) tuples later on. Signed-off-by: Jan Pokorný --- format.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/format.py b/format.py index d79c174..73b4c7e 100644 --- a/format.py +++ b/format.py @@ -308,7 +308,8 @@ class Format(object): produced = producer(protocol, *args, **kwargs) if produced is None: continue - if that_cls is self.__class__: + if (that_cls is self.__class__ + and protocol not in self._representations): # computed -> stored normalization self.swallow(protocol, *arg2wrapped(produced)) else: -- cgit