Mesa (master): nir: correct use of identity check in python
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Nov 4 16:07:07 UTC 2019
Module: Mesa
Branch: master
Commit: 717606f9f32af6540b68336e676fca9dd16f282a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=717606f9f32af6540b68336e676fca9dd16f282a
Author: Dylan Baker <dylan at pnwbakers.com>
Date: Fri Oct 25 13:48:38 2019 -0700
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 <mattst88 at gmail.com>
---
src/compiler/nir/nir_algebraic.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/nir_algebraic.py
index d8d0a95a6d3..e13872869a5 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')
More information about the mesa-commit
mailing list