Pylint: RuntimeError with Python 3.7

Created on 21 May 2018  路  2Comments  路  Source: PyCQA/pylint

Steps to reproduce

$ cd /tmp/
$ python3.7 -m venv tmp20180521
$ . tmp20180521/bin/activate
$ cat >> bug.py
from datetime import datetime, timedelta
$ python3 -m pip install pylint
Collecting pylint
  Using cached https://files.pythonhosted.org/packages/3f/88/e0c9a506255ae3915ac1f183a13853d5b4a3e435972d0df6ea190d5d1e96/pylint-1.9.1-py2.py3-none-any.whl
Collecting six (from pylint)
  Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting astroid<2.0,>=1.6 (from pylint)
  Using cached https://files.pythonhosted.org/packages/7f/4f/162e1c859f59031ee7d3ff48ca6a3eaa699e4b8bfcb4f2988b5677d74605/astroid-1.6.4-py2.py3-none-any.whl
Collecting mccabe (from pylint)
  Using cached https://files.pythonhosted.org/packages/87/89/479dc97e18549e21354893e4ee4ef36db1d237534982482c3681ee6e7b57/mccabe-0.6.1-py2.py3-none-any.whl
Collecting isort>=4.2.5 (from pylint)
  Using cached https://files.pythonhosted.org/packages/1f/2c/22eee714d7199ae0464beda6ad5fedec8fee6a2f7ffd1e8f1840928fe318/isort-4.3.4-py3-none-any.whl
Collecting lazy-object-proxy (from astroid<2.0,>=1.6->pylint)
Collecting wrapt (from astroid<2.0,>=1.6->pylint)
Installing collected packages: six, lazy-object-proxy, wrapt, astroid, mccabe, isort, pylint
Successfully installed astroid-1.6.4 isort-4.3.4 lazy-object-proxy-1.3.1 mccabe-0.6.1 pylint-1.9.1 six-1.11.0 wrapt-1.10.11
$ pylint bug.py
No config file found, using default configuration
************* Module bug
C:  1, 0: Missing module docstring (missing-docstring)
Traceback (most recent call last):
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/decorators.py", line 89, in wrapped
    res = next(generator)
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/decorators.py", line 104, in wrapped
    raise StopIteration
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/tmp/tmp20180521/bin/pylint", line 11, in <module>
    sys.exit(run_pylint())
  File "/tmp/tmp20180521/lib/python3.7/site-packages/pylint/__init__.py", line 16, in run_pylint
    Run(sys.argv[1:])
  File "/tmp/tmp20180521/lib/python3.7/site-packages/pylint/lint.py", line 1347, in __init__
    linter.check(args)
  File "/tmp/tmp20180521/lib/python3.7/site-packages/pylint/lint.py", line 768, in check
    self._do_check(files_or_modules)
  File "/tmp/tmp20180521/lib/python3.7/site-packages/pylint/lint.py", line 901, in _do_check
    self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
  File "/tmp/tmp20180521/lib/python3.7/site-packages/pylint/lint.py", line 980, in check_astroid_module
    walker.walk(ast_node)
  File "/tmp/tmp20180521/lib/python3.7/site-packages/pylint/utils.py", line 1014, in walk
    self.walk(child)
  File "/tmp/tmp20180521/lib/python3.7/site-packages/pylint/utils.py", line 1011, in walk
    cb(astroid)
  File "/tmp/tmp20180521/lib/python3.7/site-packages/pylint/checkers/variables.py", line 1260, in visit_importfrom
    module = node.do_import_module(name_parts[0])
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/mixins.py", line 119, in do_import_module
    relative_only=level and level >= 1)
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/scoped_nodes.py", line 593, in import_module
    return MANAGER.ast_from_module_name(absmodname)
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/manager.py", line 154, in ast_from_module_name
    return self.ast_from_file(found_spec.location, modname, fallback=False)
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/manager.py", line 80, in ast_from_file
    return AstroidBuilder(self).file_build(filepath, modname)
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/builder.py", line 153, in file_build
    return self._post_build(module, encoding)
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/builder.py", line 173, in _post_build
    self.delayed_assattr(delayed)
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/builder.py", line 232, in delayed_assattr
    for inferred in node.expr.infer():
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/decorators.py", line 89, in wrapped
    res = next(generator)
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/bases.py", line 95, in _infer_stmts
    for inferred in stmt.infer(context=context):
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/context.py", line 71, in cache_generator
    for result in generator:
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/decorators.py", line 89, in wrapped
    res = next(generator)
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/bases.py", line 95, in _infer_stmts
    for inferred in stmt.infer(context=context):
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/context.py", line 71, in cache_generator
    for result in generator:
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/decorators.py", line 142, in raise_if_nothing_inferred
    yield next(generator)
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/decorators.py", line 89, in wrapped
    res = next(generator)
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/inference.py", line 166, in infer_call
    for callee in self.func.infer(context):
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/context.py", line 71, in cache_generator
    for result in generator:
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/decorators.py", line 89, in wrapped
    res = next(generator)
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/decorators.py", line 142, in raise_if_nothing_inferred
    yield next(generator)
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/inference.py", line 259, in infer_attribute
    for obj in owner.igetattr(self.attrname, context):
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/scoped_nodes.py", line 2294, in igetattr
    attrs = self.getattr(name, context, class_context=class_context)
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/scoped_nodes.py", line 2231, in getattr
    values += self._metaclass_lookup_attribute(name, context)
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/scoped_nodes.py", line 2247, in _metaclass_lookup_attribute
    attrs.update(set(cls_attributes))
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/scoped_nodes.py", line 2253, in _get_attribute_from_metaclass
    class_context=True)
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/scoped_nodes.py", line 2227, in getattr
    for classnode in self.ancestors(recurs=True, context=context):
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/scoped_nodes.py", line 2046, in ancestors
    for baseobj in stmt.infer(context):
  File "/tmp/tmp20180521/lib/python3.7/site-packages/astroid/context.py", line 71, in cache_generator
    for result in generator:
RuntimeError: generator raised StopIteration

pylint --version output

$ pylint --version
No config file found, using default configuration
pylint 1.9.1, 
astroid 1.6.4
Python 3.7.0b4 (default, May 21 2018, 17:02:44) 
[GCC 6.3.0 20170516]

Most helpful comment

Thanks. For the record I had to use:

pip install pylint --pre --upgrade --upgrade-strategy eager

All 2 comments

Please give it a go with pip install pylint --pre.

Thanks. For the record I had to use:

pip install pylint --pre --upgrade --upgrade-strategy eager

Was this page helpful?
0 / 5 - 0 ratings