You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was expecting it to find the check_equal function. Running with python3.7, astroid 2.2.5, I get this exception:
Traceback
Traceback (most recent call last):
File "/home/user/.local/pipx/venvs/ipython/lib/python3.7/site-packages/astroid/decorators.py", line 131, in raise_if_nothing_inferredyieldnext(generator)
StopIteration: {'node': <Call l.8 at 0x7fb9dcbfd5c0>, 'context': <astroid.context.InferenceContext object at 0x7fb9dcbfa0f8>}
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/user/tmp/inf.py", line 21, in <module>
tree = astroid.parse(source)
File "/home/user/.local/pipx/venvs/ipython/lib/python3.7/site-packages/astroid/builder.py", line 275, in parsereturn builder.string_build(code, modname=module_name, path=path)
File "/home/user/.local/pipx/venvs/ipython/lib/python3.7/site-packages/astroid/builder.py", line 142, in string_buildreturnself._post_build(module, "utf-8")
File "/home/user/.local/pipx/venvs/ipython/lib/python3.7/site-packages/astroid/builder.py", line 160, in _post_build
module =self._manager.visit_transforms(module)
File "/home/user/.local/pipx/venvs/ipython/lib/python3.7/site-packages/astroid/manager.py", line 69, in visit_transformsreturnself._transform.visit(node)
File "/home/user/.local/pipx/venvs/ipython/lib/python3.7/site-packages/astroid/transforms.py", line 89, in visit
module.body = [self._visit(child) for child in module.body]
File "/home/user/.local/pipx/venvs/ipython/lib/python3.7/site-packages/astroid/transforms.py", line 89, in <listcomp>
module.body = [self._visit(child) for child in module.body]
File "/home/user/.local/pipx/venvs/ipython/lib/python3.7/site-packages/astroid/transforms.py", line 54, in _visit
visited =self._visit_generic(value)
File "/home/user/.local/pipx/venvs/ipython/lib/python3.7/site-packages/astroid/transforms.py", line 61, in _visit_genericreturn [self._visit_generic(child) for child in node]
File "/home/user/.local/pipx/venvs/ipython/lib/python3.7/site-packages/astroid/transforms.py", line 61, in <listcomp>return [self._visit_generic(child) for child in node]
File "/home/user/.local/pipx/venvs/ipython/lib/python3.7/site-packages/astroid/transforms.py", line 67, in _visit_genericreturnself._visit(node)
File "/home/user/.local/pipx/venvs/ipython/lib/python3.7/site-packages/astroid/transforms.py", line 54, in _visit
visited =self._visit_generic(value)
File "/home/user/.local/pipx/venvs/ipython/lib/python3.7/site-packages/astroid/transforms.py", line 67, in _visit_genericreturnself._visit(node)
File "/home/user/.local/pipx/venvs/ipython/lib/python3.7/site-packages/astroid/transforms.py", line 57, in _visitreturnself._transform(node)
File "/home/user/.local/pipx/venvs/ipython/lib/python3.7/site-packages/astroid/transforms.py", line 40, in _transform
ret = transform_func(node)
File "/home/user/tmp/inf.py", line 16, in transform_callfor func in node.infer():
File "/home/user/.local/pipx/venvs/ipython/lib/python3.7/site-packages/astroid/decorators.py", line 136, in raise_if_nothing_inferredraise exceptions.InferenceError(**error.args[0])
astroid.exceptions.InferenceError: Inference failed for <Call l.8 at 0x7fb9dcbfd5c0>.
I'm guessing this may be related to #485, but not sure. Am I doing something wrong or is there a workaround I can use? Thanks!
The text was updated successfully, but these errors were encountered:
jtrakk
changed the title
Inference fails on function assert-only function
Inference fails on assert-only function
May 4, 2019
Thanks for the report! You are not doing anything wrong, it's just a bug in the inference engine. We should infer an empty return there, instead of crashing if there is no explicit return in the body of the function. A workaround for now is to modify your code to have a blank return in it or to modify your transform and look for any return statements in the body of the function before triggering the inference code for that function.
I'm getting started with
astroid
. I want to find the functions that are called inside thetest_sth
function.I was expecting it to find the
check_equal
function. Running with python3.7, astroid 2.2.5, I get this exception:Traceback
I'm guessing this may be related to #485, but not sure. Am I doing something wrong or is there a workaround I can use? Thanks!
The text was updated successfully, but these errors were encountered: