Skip to content

Commit c049167

Browse files
authored
[AMD] Fix constexpr equality check (#7034)
The existing code is checking `val in (elem)`, but `()` doesn't define a tuple, `(elem,)` does. As a result, this is actually check if the element contains val, which is a subtle unsafe bug, that hopefully never has practical implications.
1 parent 1f53afc commit c049167

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

third_party/amd/backend/driver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def _extracted_type(ty):
213213
return f"[{val}]"
214214
if ty[0] == '*':
215215
return "PyObject*"
216-
if ty in ("constexpr"):
216+
if ty == "constexpr":
217217
return "PyObject*"
218218
return ty_to_cpp(ty)
219219

@@ -223,7 +223,7 @@ def format_of(ty):
223223
return f"({val})"
224224
if ty[0] == '*':
225225
return "O"
226-
if ty in ("constexpr"):
226+
if ty == "constexpr":
227227
return "O"
228228
return {
229229
"float": "f",

0 commit comments

Comments
 (0)