Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'AsyncFunctionDef' object has no attribute 'statement' #8

Closed
orsinium opened this issue Sep 14, 2021 · 3 comments
Closed

Comments

@orsinium
Copy link

Code:

async def f():
    pass

Error:

❯ klara tmp.py
loaded extension: {'typeshed_stub.py', 'builtin_inference.py', '__init__.py', 'infer_z3.py', '99_math_z3.py'}

using configuration value: 
{   'config_file': None,
    'eq_neq': False,
    'input_test_file': 'tmp.py',
    'max_inference_value': None,
    'py_version': 3,
    'stubs': [],
    'type_inference': True,
    'typeshed_select': []}

Traceback (most recent call last):
  File "/home/gram/.local/bin/klara", line 8, in <module>
    sys.exit(main())
  File "/home/gram/.local/lib/python3.9/site-packages/klara/contract/__main__.py", line 50, in main
    output_test = run(input_file.read_text(), input_file.stem)
  File "/home/gram/.local/lib/python3.9/site-packages/klara/contract/__main__.py", line 36, in run
    cfg = MANAGER.build_cfg(tree)
  File "/home/gram/.local/lib/python3.9/site-packages/klara/klara_z3/cov_manager.py", line 64, in build_cfg
    c = cfg.Cfg(as_tree)
  File "/home/gram/.local/lib/python3.9/site-packages/klara/core/cfg.py", line 509, in __init__
    self.root, _, _ = self.parse(as_tree)
  File "/home/gram/.local/lib/python3.9/site-packages/klara/core/cfg.py", line 629, in parse
    head = self.build(basic_block, head, all_tail_list, func_tail_list)
  File "/home/gram/.local/lib/python3.9/site-packages/klara/core/cfg.py", line 535, in build
    tail_list, func_tail = meth(block)
  File "/home/gram/.local/lib/python3.9/site-packages/klara/core/cfg.py", line 589, in build_module
    head_returned, tail_list, _ = self.parse(self.as_tree.body)
  File "/home/gram/.local/lib/python3.9/site-packages/klara/core/cfg.py", line 627, in parse
    for basic_block in basic_block_parser.get_basic_block():
  File "/home/gram/.local/lib/python3.9/site-packages/klara/core/cfg.py", line 840, in get_basic_block
    basic_block_list = self.visit(node)
  File "/home/gram/.local/lib/python3.9/site-packages/klara/core/cfg.py", line 821, in visit
    return visitor(ast_node)
  File "/home/gram/.local/lib/python3.9/site-packages/klara/core/cfg.py", line 824, in generic_visit
    self._append_cache(ast_node.statement())
AttributeError: 'AsyncFunctionDef' object has no attribute 'statement'

@orsinium
Copy link
Author

orsinium commented Sep 14, 2021

A similar one: AttributeError: 'JoinedStr' object has no attribute 'statement'. I tried to install klara on both Python 3.7 and 3.9

@oaustegard
Copy link
Contributor

I received the same exact error when attempting to run against two different real-world python files. It worked fine however when ran against the exact test.py file from the README...

@usagitoneko97
Copy link
Owner

Implemented JoinedStr and FormattedValue here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants