Skip to content

Commit

Permalink
tracer: add PyPy support to get_var_name().
Browse files Browse the repository at this point in the history
Fixes #141.
  • Loading branch information
programmerjake authored and whitequark committed Jul 9, 2019
1 parent 367ad5a commit 62b3e36
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .travis.yml
Expand Up @@ -3,6 +3,7 @@ language: python
python:
- "3.6"
- "3.7"
- "pypy3"
cache:
directories:
- "$HOME/.ccache"
Expand All @@ -23,3 +24,7 @@ script:
- python setup.py develop
- coverage run -m unittest discover
- codecov
matrix:
fast_finish: true
allow_failures:
- python: "pypy3"
7 changes: 6 additions & 1 deletion nmigen/tracer.py
Expand Up @@ -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

Expand Down

0 comments on commit 62b3e36

Please sign in to comment.