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
This commit is contained in:
Cédric Krier
2022-11-05 09:51:17 +01:00
parent 7e04038e64
commit afd411fd78
+2 -4
View File
@@ -32,8 +32,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:
@@ -46,8 +45,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: