diff options
author | Dylan Baker <[email protected]> | 2019-10-25 13:48:38 -0700 |
---|---|---|
committer | Dylan Baker <[email protected]> | 2019-11-05 08:46:48 -0800 |
commit | c1f1a1056f21e8f8be0e06958d2139cf84b519c0 (patch) | |
tree | 863647fdf20cfcfecd874f27909b23b3c63c4f38 | |
parent | 13768f3714a53fd6e599baa7fa10b64bb64c94fb (diff) |
nir: correct use of identity check in python
Python has the identity operator `is`, and the equality operator `==`.
Using `is` with strings sometimes works in CPython due to optimizations
(they have some kind of cache), but it may not always work.
Fixes: 96c4b135e34d0804e41bfbc28fc1b5050c49d71e
("nir/algebraic: Don't put quotes around floating point literals")
Reviewed-by: Matt Turner <[email protected]>
(cherry picked from commit 717606f9f32af6540b68336e676fca9dd16f282a)
-rw-r--r-- | src/compiler/nir/nir_algebraic.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/nir_algebraic.py index 3b136f800d4..9ce47445f9b 100644 --- a/src/compiler/nir/nir_algebraic.py +++ b/src/compiler/nir/nir_algebraic.py @@ -301,8 +301,8 @@ class Variable(Value): # constant. If we want to support names that have numeric or # punctuation characters, we can me the first assertion more flexible. assert self.var_name.isalpha() - assert self.var_name is not 'True' - assert self.var_name is not 'False' + assert self.var_name != 'True' + assert self.var_name != 'False' self.is_constant = m.group('const') is not None self.cond = m.group('cond') |