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: 96c4b135e3
       ("nir/algebraic: Don't put quotes around floating point literals")
Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
Dylan Baker 2019-10-25 13:48:38 -07:00
parent 28440820ef
commit 717606f9f3

View file

@ -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')