Skip to content

import setuptools.command.develop causes internal exception #3152

Closed
@chadrik

Description

@chadrik

Steps to reproduce

Create a file called setup.py like this:

import setuptools.command.develop

or like this:

import setuptools

class Custom(setuptools.Command):
  pass

Current behavior

pylint setup.py
************* Module setup
Traceback (most recent call last):
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/__init__.py", line 91, in _inference_tip_cached
    return iter(_cache[func, node])
KeyError: (<function register_builtin_transform.<locals>._transform_wrapper at 0x1092461e0>, <Call l.40 at 0x109a4dc88>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/__init__.py", line 91, in _inference_tip_cached
    return iter(_cache[func, node])
KeyError: (<function register_builtin_transform.<locals>._transform_wrapper at 0x1092461e0>, <Call l.40 at 0x109a4dc88>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/__init__.py", line 91, in _inference_tip_cached
    return iter(_cache[func, node])
KeyError: (<function register_builtin_transform.<locals>._transform_wrapper at 0x1092461e0>, <Call l.40 at 0x109a4dc88>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/__init__.py", line 91, in _inference_tip_cached
    return iter(_cache[func, node])
KeyError: (<function register_builtin_transform.<locals>._transform_wrapper at 0x1092461e0>, <Call l.40 at 0x109a4dc88>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/__init__.py", line 91, in _inference_tip_cached
    return iter(_cache[func, node])
KeyError: (<function register_builtin_transform.<locals>._transform_wrapper at 0x1092461e0>, <Call l.40 at 0x109a4dc88>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/__init__.py", line 91, in _inference_tip_cached
    return iter(_cache[func, node])
KeyError: (<function register_builtin_transform.<locals>._transform_wrapper at 0x1092461e0>, <Call l.40 at 0x109a4dc88>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/__init__.py", line 91, in _inference_tip_cached
    return iter(_cache[func, node])
KeyError: (<function register_builtin_transform.<locals>._transform_wrapper at 0x1092461e0>, <Call l.40 at 0x109a4dc88>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/__init__.py", line 91, in _inference_tip_cached
    return iter(_cache[func, node])
KeyError: (<function register_builtin_transform.<locals>._transform_wrapper at 0x1092461e0>, <Call l.40 at 0x109a4dc88>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/__init__.py", line 91, in _inference_tip_cached
    return iter(_cache[func, node])
KeyError: (<function register_builtin_transform.<locals>._transform_wrapper at 0x1092461e0>, <Call l.40 at 0x109a4dc88>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/__init__.py", line 91, in _inference_tip_cached
    return iter(_cache[func, node])
KeyError: (<function register_builtin_transform.<locals>._transform_wrapper at 0x1092461e0>, <Call l.40 at 0x109a4dc88>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/__init__.py", line 91, in _inference_tip_cached
    return iter(_cache[func, node])
KeyError: (<function register_builtin_transform.<locals>._transform_wrapper at 0x1092461e0>, <Call l.40 at 0x109a4dc88>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/__init__.py", line 91, in _inference_tip_cached
    return iter(_cache[func, node])
KeyError: (<function register_builtin_transform.<locals>._transform_wrapper at 0x1092461e0>, <Call l.40 at 0x109a4dc88>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/__init__.py", line 91, in _inference_tip_cached
    return iter(_cache[func, node])
KeyError: (<function register_builtin_transform.<locals>._transform_wrapper at 0x1092461e0>, <Call l.40 at 0x109a4dc88>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/__init__.py", line 91, in _inference_tip_cached
    return iter(_cache[func, node])
KeyError: (<function register_builtin_transform.<locals>._transform_wrapper at 0x1092461e0>, <Call l.40 at 0x109a4dc88>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/__init__.py", line 91, in _inference_tip_cached
    return iter(_cache[func, node])
KeyError: (<function register_builtin_transform.<locals>._transform_wrapper at 0x1092461e0>, <Call l.40 at 0x109a4dc88>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/__init__.py", line 91, in _inference_tip_cached
    return iter(_cache[func, node])
KeyError: (<function register_builtin_transform.<locals>._transform_wrapper at 0x1092461e0>, <Call l.40 at 0x109a4dc88>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/chad/dev/beam-tests/.venv3/bin/pylint", line 10, in <module>
    sys.exit(run_pylint())
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/pylint/__init__.py", line 20, in run_pylint
    Run(sys.argv[1:])
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/pylint/lint.py", line 1731, in __init__
    linter.check(args)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/pylint/lint.py", line 1004, in check
    self._do_check(files_or_modules)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/pylint/lint.py", line 1165, in _do_check
    self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/pylint/lint.py", line 1252, in check_astroid_module
    walker.walk(ast_node)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/pylint/utils/ast_walker.py", line 77, in walk
    self.walk(child)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/pylint/utils/ast_walker.py", line 74, in walk
    callback(astroid)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/pylint/checkers/imports.py", line 498, in visit_import
    imported_module = self._get_imported_module(node, name)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/pylint/checkers/imports.py", line 774, in _get_imported_module
    return importnode.do_import_module(modname)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/mixins.py", line 100, in do_import_module
    modname, level=level, relative_only=level and level >= 1
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/scoped_nodes.py", line 629, in import_module
    return MANAGER.ast_from_module_name(absmodname)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/manager.py", line 174, in ast_from_module_name
    return self.ast_from_file(found_spec.location, modname, fallback=False)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/manager.py", line 94, in ast_from_file
    return AstroidBuilder(self).file_build(filepath, modname)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/builder.py", line 136, in file_build
    return self._post_build(module, encoding)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/builder.py", line 156, in _post_build
    self.delayed_assattr(delayed)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/builder.py", line 223, in delayed_assattr
    for inferred in node.expr.infer():
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/decorators.py", line 131, in raise_if_nothing_inferred
    yield next(generator)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/decorators.py", line 95, in wrapped
    res = next(generator)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/bases.py", line 133, in _infer_stmts
    for inferred in stmt.infer(context=context):
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/util.py", line 160, in limit_inference
    yield from islice(iterator, size)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/context.py", line 113, in cache_generator
    for result in generator:
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/decorators.py", line 131, in raise_if_nothing_inferred
    yield next(generator)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/decorators.py", line 92, in wrapped
    generator = _func(node, context, **kwargs)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/inference.py", line 840, in infer_assign
    stmts = list(self.assigned_stmts(context=context))
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/protocols.py", line 324, in _arguments_infer_argname
    is_metaclass = isinstance(cls, nodes.ClassDef) and cls.type == "metaclass"
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/scoped_nodes.py", line 1785, in _class_type
    if _is_metaclass(klass):
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/scoped_nodes.py", line 1754, in _is_metaclass
    for baseobj in base.infer():
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/decorators.py", line 131, in raise_if_nothing_inferred
    yield next(generator)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/decorators.py", line 95, in wrapped
    res = next(generator)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/bases.py", line 133, in _infer_stmts
    for inferred in stmt.infer(context=context):
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/util.py", line 160, in limit_inference
    yield from islice(iterator, size)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/context.py", line 113, in cache_generator
    for result in generator:
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/decorators.py", line 131, in raise_if_nothing_inferred
    yield next(generator)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/decorators.py", line 92, in wrapped
    generator = _func(node, context, **kwargs)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/inference.py", line 267, in infer_import_from
    module = self.do_import_module()
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/mixins.py", line 100, in do_import_module
    modname, level=level, relative_only=level and level >= 1
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/scoped_nodes.py", line 629, in import_module
    return MANAGER.ast_from_module_name(absmodname)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/manager.py", line 174, in ast_from_module_name
    return self.ast_from_file(found_spec.location, modname, fallback=False)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/manager.py", line 94, in ast_from_file
    return AstroidBuilder(self).file_build(filepath, modname)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/builder.py", line 136, in file_build
    return self._post_build(module, encoding)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/builder.py", line 156, in _post_build
    self.delayed_assattr(delayed)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/builder.py", line 223, in delayed_assattr
    for inferred in node.expr.infer():
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/decorators.py", line 131, in raise_if_nothing_inferred
    yield next(generator)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/decorators.py", line 95, in wrapped
    res = next(generator)
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/bases.py", line 133, in _infer_stmts
    for inferred in stmt.infer(context=context
...
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/context.py", line 113, in cache_generator
    for result in generator:
  File "/Users/chad/dev/beam-tests/.venv3/lib/python3.7/site-packages/astroid/decorators.py", line 128, in raise_if_nothing_inferred
    generator = func(*args, **kwargs)
RecursionError: maximum recursion depth exceeded while calling a Python object

Expected behavior

No error

pylint --version output

pylint 2.4.2
astroid 2.3.1
Python 3.7.3 (default, Jun 19 2019, 07:40:15) 
[Clang 10.0.0 (clang-1000.11.45.5)]

Activity

PCManticore

PCManticore commented on Oct 3, 2019

@PCManticore
Contributor

I can reproduce the issue, thanks.

modified the milestones: Next minor release, Next bug fix release on Oct 3, 2019
added a commit that references this issue on Oct 18, 2019
ed42e0c
PCManticore

PCManticore commented on Oct 18, 2019

@PCManticore
Contributor

This is fixed in astroid and will release it shortly as 2.3.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @chadrik@PCManticore

        Issue actions

          import setuptools.command.develop causes internal exception · Issue #3152 · pylint-dev/pylint