Skip to content

Commit

Permalink
Guard two more calls to inspect
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardt committed Apr 29, 2019
1 parent 75e4503 commit 7641e86
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion magma/syntax/combinational.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import types
from magma.debug import debug_info
from magma.ssa import convert_tree_to_ssa
from magma.config import get_debug_mode


class CircuitDefinitionSyntaxError(Exception):
Expand Down Expand Up @@ -213,7 +214,7 @@ def combinational(defn_env: dict, fn: types.FunctionType):
debug(source)
circuit_def = ast_utils.compile_function_to_file(tree, fn.__name__,
defn_env)
if getattr(circuit_def, "debug_info", False):
if get_debug_mode() and getattr(circuit_def, "debug_info", False):
circuit_def.debug_info = debug_info(circuit_def.debug_info.filename,
circuit_def.debug_info.lineno,
inspect.getmodule(fn))
Expand Down
3 changes: 2 additions & 1 deletion magma/syntax/sequential.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import functools
import magma as m
from magma.ssa import convert_tree_to_ssa
from magma.config import get_debug_mode
from collections import Counter


Expand Down Expand Up @@ -355,7 +356,7 @@ def _sequential(defn_env: dict, cls):
ast.parse("from mantle import DefineRegister").body[0],
] + tree.body)
circuit_def = ast_utils.compile_function_to_file(tree, cls.__name__, defn_env)
if getattr(circuit_def, "debug_info", False):
if get_debug_mode() and getattr(circuit_def, "debug_info", False):
circuit_def.debug_info = debug_info(circuit_def.debug_info.filename,
circuit_def.debug_info.lineno,
inspect.getmodule(cls))
Expand Down

0 comments on commit 7641e86

Please sign in to comment.