From 816abe1fd86d16ec6f90eb36cdd32920feb67b8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 5 Nov 2022 09:51:17 +0100 Subject: [PATCH] Do not expand boolean PYSON when using __and__ and __or__ It is not expected that the left operand is modified by such operations. issue11836 review418551003 (grafted from 393ef20df4b30ead8ef189e99cf03976abe0be08) --HG-- branch : 6.0 --- proteus/pyson.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/proteus/pyson.py b/proteus/pyson.py index 0f2ed608c6..9dc06dc11d 100644 --- a/proteus/pyson.py +++ b/proteus/pyson.py @@ -31,8 +31,7 @@ class PYSON(object): other = Bool(other) if (isinstance(self, And) and not isinstance(self, Or)): - self._statements.append(other) - return self + return And(*self._statements, other) if self.types() != {bool}: return And(Bool(self), other) else: @@ -45,8 +44,7 @@ class PYSON(object): and other.types() != {bool}): other = Bool(other) if isinstance(self, Or): - self._statements.append(other) - return self + return Or(*self._statements, other) if self.types() != {bool}: return Or(Bool(self), other) else: