mirror of
https://github.com/myhdl/myhdl.git
synced 2024-12-14 07:44:38 +08:00
Use compile instead of ast.parse() so that future flags can be passed #179
To my suprize, explitly passing the future flags was not required; apparently the dont_inherit argument is different for ast.parse()
This commit is contained in:
parent
d5501698cc
commit
1761fc2a0e
@ -76,7 +76,10 @@ def _dedent(s):
|
|||||||
def _makeAST(f):
|
def _makeAST(f):
|
||||||
s = inspect.getsource(f)
|
s = inspect.getsource(f)
|
||||||
s = _dedent(s)
|
s = _dedent(s)
|
||||||
tree = ast.parse(s)
|
# use compile instead of ast.parse so that additional flags can be passed
|
||||||
|
flags = ast.PyCF_ONLY_AST
|
||||||
|
tree = compile(s, filename='<unknown>', mode='exec', flags=flags)
|
||||||
|
# tree = ast.parse(s)
|
||||||
tree.sourcefile = inspect.getsourcefile(f)
|
tree.sourcefile = inspect.getsourcefile(f)
|
||||||
tree.lineoffset = inspect.getsourcelines(f)[1] - 1
|
tree.lineoffset = inspect.getsourcelines(f)[1] - 1
|
||||||
return tree
|
return tree
|
||||||
|
Loading…
x
Reference in New Issue
Block a user