Skip to content
Snippets Groups Projects
Commit c1f1a105 authored by Dylan Baker's avatar Dylan Baker
Browse files

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: 96c4b135
       ("nir/algebraic: Don't put quotes around floating point literals")
Reviewed-by: default avatarMatt Turner <mattst88@gmail.com>
(cherry picked from commit 717606f9)
parent 13768f37
No related branches found
No related tags found
No related merge requests found
......@@ -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')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment