From: Jacob Lifshay Date: Tue, 9 Jul 2019 07:29:01 +0000 (-0700) Subject: tracer: add PyPy support to get_var_name(). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1e942b955f554f528f1721b94e0ccd194fbfd923;p=nmigen.git tracer: add PyPy support to get_var_name(). Fixes #141. --- diff --git a/.travis.yml b/.travis.yml index fea7d80..22af903 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ language: python python: - "3.6" - "3.7" + - "pypy3" cache: directories: - "$HOME/.ccache" @@ -23,3 +24,7 @@ script: - python setup.py develop - coverage run -m unittest discover - codecov +matrix: + fast_finish: true + allow_failures: + - python: "pypy3" diff --git a/nmigen/tracer.py b/nmigen/tracer.py index 49c9650..eb8a71e 100644 --- a/nmigen/tracer.py +++ b/nmigen/tracer.py @@ -20,7 +20,12 @@ def get_var_name(depth=2, default=_raise_exception): code = frame.f_code call_index = frame.f_lasti - call_opc = opname[code.co_code[call_index]] + while True: + call_opc = opname[code.co_code[call_index]] + if call_opc in ("EXTENDED_ARG"): + call_index += 2 + else: + break if call_opc not in ("CALL_FUNCTION", "CALL_FUNCTION_KW", "CALL_FUNCTION_EX", "CALL_METHOD"): return None