From aaec7e0d276b88dfb08e5f6bcb1db5279ceca242 Mon Sep 17 00:00:00 2001 From: Catherine Date: Tue, 31 Jan 2023 10:32:44 +0000 Subject: [PATCH] tracer: return default name on unrecognized opcode. The default name is more commonly returned on code such as: x, y = Signal(), Signal() The case where the opcode is not recognized is only encountered when older Amaranth is ran on a newer Python interpreter (with more opcodes). Returning None instead of a name here caused issues in the RTLIL backend, which would incorrectly use $\d+ names for ports, since the RTLIL backend assumed the name of a signal is always a string. Fixes #733. --- amaranth/tracer.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/amaranth/tracer.py b/amaranth/tracer.py index 3cbce9a..5a21dd0 100644 --- a/amaranth/tracer.py +++ b/amaranth/tracer.py @@ -24,8 +24,9 @@ def get_var_name(depth=2, default=_raise_exception): call_index += 2 else: break - if call_opc not in ("CALL_FUNCTION", "CALL_FUNCTION_KW", "CALL_FUNCTION_EX", "CALL_METHOD", "CALL"): - return None + if call_opc not in ("CALL_FUNCTION", "CALL_FUNCTION_KW", "CALL_FUNCTION_EX", + "CALL_METHOD", "CALL"): + return default index = call_index + 2 while True: