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

Crash due to Uninferable type #866

Closed
swails opened this issue Dec 17, 2020 · 2 comments · Fixed by #876 or PennyDreadfulMTG/Penny-Dreadful-Tools#8447
Closed

Crash due to Uninferable type #866

swails opened this issue Dec 17, 2020 · 2 comments · Fixed by #876 or PennyDreadfulMTG/Penny-Dreadful-Tools#8447
Assignees
Labels
Bug 🪳 Needs reproduction 🔍 Need a way to reproduce it locally on a maintainer's machine

Comments

@swails
Copy link

swails commented Dec 17, 2020

Steps to reproduce

I'm not sure exactly where the code that is breaking pylint is located

Current behavior

pylint crashes:

Fixes this bug in pylint:

Traceback (most recent call last):
  File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/astroid/__init__.py", line 93, in _inference_tip_cached
    return iter(_cache[func, node])
KeyError: (<function register_builtin_transform.<locals>._transform_wrapper at 0x7f9bd8b34040>, <Call l.281 at 0x7f9bd3b28340>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/scratch2/anaconda3/envs/entos/bin/pylint", line 11, in <module>
    sys.exit(run_pylint())
  File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/pylint/__init__.py", line 22, in run_pylint
    PylintRun(sys.argv[1:])
  File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/pylint/lint/run.py", line 349, in __init__
    linter.check(args)
  File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 862, in check
    self._check_files(
  File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 896, in _check_files
    self._check_file(get_ast, check_astroid_module, name, filepath, modname)
  File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 922, in _check_file
    check_astroid_module(ast_node)
  File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 1054, in check_astroid_module
    retval = self._check_astroid_module(
  File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 1099, in _check_astroid_module
    walker.walk(ast_node)
  File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/pylint/utils/ast_walker.py", line 75, in walk
    self.walk(child)
  File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/pylint/utils/ast_walker.py", line 75, in walk
    self.walk(child)
  File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/pylint/utils/ast_walker.py", line 72, in walk
    callback(astroid)
  File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/pylint/checkers/classes.py", line 1866, in visit_functiondef
    inferred = _safe_infer_call_result(node, node)
  File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/pylint/checkers/classes.py", line 449, in _safe_infer_call_result
    next(inferit)
  File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/astroid/scoped_nodes.py", line 1722, in infer_call_result
    yield from returnnode.value.infer(context)
  File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/astroid/node_classes.py", line 357, in infer
    return self._explicit_inference(self, context, **kwargs)
  File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/astroid/__init__.py", line 95, in _inference_tip_cached
    result = func(*args, **kwargs)
  File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/astroid/brain/brain_builtin_inference.py", line 135, in _transform_wrapper
    result = transform(node, context=context)
  File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/astroid/brain/brain_builtin_inference.py", line 219, in _infer_builtin_container
    return _container_generic_inference(node, context, klass, transform_func)
  File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/astroid/brain/brain_builtin_inference.py", line 172, in _container_generic_inference
    transformed = transform(inferred)
  File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/astroid/brain/brain_builtin_inference.py", line 188, in _container_generic_transform
    inferred = helpers.safe_infer(element, context=context)
  File "/scratch2/anaconda3/envs/entos/lib/python3.8/site-packages/astroid/helpers.py", line 153, in safe_infer
    value = next(inferit)
TypeError: 'Uninferable' object is not an iterator

Expected behavior

pylint finishes normally

python -c "from astroid import __pkginfo__; print(__pkginfo__.version)" output

2.4.2

@swails swails changed the title Crash due to Crash due to Uninferable type Dec 17, 2020
@PCManticore
Copy link
Contributor

Thanks for the report. Unfortunately it's really hard to figure out what went wrong here without a reproduction example. Is it possible to reduce the code that leads to the crash to a minimal example? That should give us at least an idea on where to look.

@PCManticore PCManticore added the Needs reproduction 🔍 Need a way to reproduce it locally on a maintainer's machine label Dec 24, 2020
@PCManticore PCManticore self-assigned this Jan 1, 2021
@PCManticore
Copy link
Contributor

This will be fixed by #876. Thanks for the report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🪳 Needs reproduction 🔍 Need a way to reproduce it locally on a maintainer's machine
Projects
None yet
2 participants