pylint-dev / astroid

A common base representation of python source code for pylint and other projects
https://pylint.readthedocs.io/projects/astroid/en/latest/
GNU Lesser General Public License v2.1
530 stars 275 forks source link

Pylint crashes due to AstroidError while handling KeyError #627

Closed adarob closed 2 years ago

adarob commented 5 years ago

Steps to reproduce

  1. Download https://github.com/tensorflow/magenta/pull/1374
  2. Run python setup.py install
  3. Run pylint magenta.

Current behavior

adarob-macbookpro2:adarob-magenta adarob$ pylint magenta.models.latent_transfer.train_joint
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/astroid/__init__.py", line 91, in _inference_tip_cached
    return iter(_cache[func, node])
KeyError: (<function _functools_partial_inference at 0x10c07dbf8>, <Call l.236 at 0x131415710>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/pylint", line 11, in <module>
    sys.exit(run_pylint())
  File "/usr/local/lib/python3.6/site-packages/pylint/__init__.py", line 20, in run_pylint
    Run(sys.argv[1:])
  File "/usr/local/lib/python3.6/site-packages/pylint/lint.py", line 1608, in __init__
    linter.check(args)
  File "/usr/local/lib/python3.6/site-packages/pylint/lint.py", line 938, in check
    self._do_check(files_or_modules)
  File "/usr/local/lib/python3.6/site-packages/pylint/lint.py", line 1071, in _do_check
    self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
  File "/usr/local/lib/python3.6/site-packages/pylint/lint.py", line 1154, in check_astroid_module
    walker.walk(ast_node)
  File "/usr/local/lib/python3.6/site-packages/pylint/utils.py", line 1269, in walk
    self.walk(child)
  File "/usr/local/lib/python3.6/site-packages/pylint/utils.py", line 1269, in walk
    self.walk(child)
  File "/usr/local/lib/python3.6/site-packages/pylint/utils.py", line 1269, in walk
    self.walk(child)
  [Previous line repeated 2 more times]
  File "/usr/local/lib/python3.6/site-packages/pylint/utils.py", line 1266, in walk
    cb(astroid)
  File "/usr/local/lib/python3.6/site-packages/pylint/checkers/base.py", line 1751, in visit_assignname
    self._check_name("variable", node.name, node)
  File "/usr/local/lib/python3.6/site-packages/pylint/checkers/base.py", line 1806, in _check_name
    if match is None and not _should_exempt_from_invalid_name(node):
  File "/usr/local/lib/python3.6/site-packages/pylint/checkers/base.py", line 1782, in _should_exempt_from_invalid_name
    inferred = utils.safe_infer(node)
  File "/usr/local/lib/python3.6/site-packages/pylint/checkers/utils.py", line 1073, in safe_infer
    value = next(inferit)
  File "/usr/local/lib/python3.6/site-packages/astroid/decorators.py", line 128, in raise_if_nothing_inferred
    yield next(generator)
  File "/usr/local/lib/python3.6/site-packages/astroid/decorators.py", line 95, in wrapped
    res = next(generator)
  File "/usr/local/lib/python3.6/site-packages/astroid/bases.py", line 135, in _infer_stmts
    for inferred in stmt.infer(context=context):
  File "/usr/local/lib/python3.6/site-packages/astroid/node_classes.py", line 348, in infer
    return self._explicit_inference(self, context, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/astroid/__init__.py", line 93, in _inference_tip_cached
    result = func(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/astroid/brain/brain_functools.py", line 77, in _functools_partial_inference
    inferred_wrapped_function = next(partial_function.infer(context=context))
  File "/usr/local/lib/python3.6/site-packages/astroid/util.py", line 160, in limit_inference
    yield from islice(iterator, size)
  File "/usr/local/lib/python3.6/site-packages/astroid/context.py", line 113, in cache_generator
    for result in generator:
  File "/usr/local/lib/python3.6/site-packages/astroid/decorators.py", line 128, in raise_if_nothing_inferred
    yield next(generator)
  File "/usr/local/lib/python3.6/site-packages/astroid/decorators.py", line 92, in wrapped
    generator = _func(node, context, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/astroid/inference.py", line 178, in infer_name
    frame, stmts = self.lookup(self.name)
  File "/usr/local/lib/python3.6/site-packages/astroid/node_classes.py", line 1083, in lookup
    return self.scope().scope_lookup(self, name)
  File "/usr/local/lib/python3.6/site-packages/astroid/scoped_nodes.py", line 1232, in scope_lookup
    return frame._scope_lookup(node, name, offset)
  File "/usr/local/lib/python3.6/site-packages/astroid/scoped_nodes.py", line 191, in _scope_lookup
    return pscope.scope_lookup(node, name)
  File "/usr/local/lib/python3.6/site-packages/astroid/scoped_nodes.py", line 1232, in scope_lookup
    return frame._scope_lookup(node, name, offset)
  File "/usr/local/lib/python3.6/site-packages/astroid/scoped_nodes.py", line 180, in _scope_lookup
    stmts = node._filter_stmts(self.locals[name], self, offset)
  File "/usr/local/lib/python3.6/site-packages/astroid/node_classes.py", line 1219, in _filter_stmts
    if not (optional_assign or are_exclusive(_stmts[pindex], node)):
  File "/usr/local/lib/python3.6/site-packages/astroid/node_classes.py", line 112, in are_exclusive
    node.locate_child(previous)[1]
  File "/usr/local/lib/python3.6/site-packages/astroid/node_classes.py", line 556, in locate_child
    raise exceptions.AstroidError(msg % (repr(child), repr(self)))
astroid.exceptions.AstroidError: Could not find <PartialFunction.pred l.229 at 0x131686828> in <If l.188 at 0x1314002e8>'s children

Expected behavior

Should not crash

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

1.6.1

PCManticore commented 5 years ago

Thanks! I'm trying to reproduce it using your branch, do you have a particular invocation of pylint you used?

adarob commented 5 years ago

I've widdled it down to this one: pylint magenta.models.latent_transfer.train_joint

dzen commented 5 years ago

Hello @PCManticore,

We've run into a similar issue, but with a different error when running pylint on aiohttp ( https://github.com/aio-libs/aiohttp )

It detect that the class AbstractResource (https://github.com/aio-libs/aiohttp/blob/master/aiohttp/web_urldispatcher.py#L55) inherit from the same base class which is imho wrong.

Here is the traceback:


  File "/home/benoit/Projects/src/astroid/astroid/decorators.py", line 31, in cached
    return cache[func]
KeyError: <bound method ClassDef.slots of <ClassDef.AbstractResource l.55 at 0x7f75b1653518>>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/benoit/Projects/src/pylint/pylint/lint.py", line 1131, in get_ast
    return MANAGER.ast_from_file(filepath, modname, source=True)
  File "/home/benoit/Projects/src/astroid/astroid/manager.py", line 87, in ast_from_file
    return AstroidBuilder(self).file_build(filepath, modname)
  File "/home/benoit/Projects/src/astroid/astroid/builder.py", line 136, in file_build
    return self._post_build(module, encoding)
  File "/home/benoit/Projects/src/astroid/astroid/builder.py", line 156, in _post_build
    self.delayed_assattr(delayed)
  File "/home/benoit/Projects/src/astroid/astroid/builder.py", line 230, in delayed_assattr
    if not _can_assign_attr(inferred, node.attrname):
  File "/home/benoit/Projects/src/astroid/astroid/builder.py", line 57, in _can_assign_attr
    slots = node.slots()
  File "/home/benoit/Projects/src/astroid/astroid/decorators.py", line 33, in cached
    cache[func] = result = func(*args, **kwargs)
  File "/home/benoit/Projects/src/astroid/astroid/scoped_nodes.py", line 2703, in slots
    slots = list(grouped_slots())
  File "/home/benoit/Projects/src/astroid/astroid/scoped_nodes.py", line 2688, in grouped_slots
    for cls in self.mro()[:-1]:
  File "/home/benoit/Projects/src/astroid/astroid/scoped_nodes.py", line 2785, in mro
    return self._compute_mro(context=context)
  File "/home/benoit/Projects/src/astroid/astroid/scoped_nodes.py", line 2765, in _compute_mro
    _verify_duplicates_mro(unmerged_mro, self, context)
  File "/home/benoit/Projects/src/astroid/astroid/scoped_nodes.py", line 99, in _verify_duplicates_mro
    context=context,
astroid.exceptions.DuplicateBasesError: Duplicates found in MROs (AbstractResource), (_GenericAlias, _Final, object), (_GenericAlias, _Final, object), (_GenericAlias, _GenericAlias) for <ClassDef.AbstractResource l.55 at 0x7f75b1653518>.```
PCManticore commented 5 years ago

@dzen Please open a separate issue, that seems unrelated to the problem reported in this one. Thanks!

nickdrozd commented 5 years ago

@adarob Here is a tiny reproducing example.

def f():
    if False:
        def g(x):
            pass

        def h():
            fa = partial(g, x=0)
            fb = partial(g, x=0)
astroid.exceptions.AstroidError: Could not find <PartialFunction.g l.3 at 0x7f909da9ffd0> in <If l.2 at 0x7f909da9fa20>'s children
nickdrozd commented 5 years ago

It looks there is a problem in locate_child comparing function g with a partial application in h:

(Pdb) child
<PartialFunction.g l.3 at 0x7f0255d5b080>
(Pdb) self.body
[<FunctionDef.g l.3 at 0x7f025605dac8>, <FunctionDef.h l.6 at 0x7f025605db38>]
PCManticore commented 5 years ago

Thanks for the investigation @nickdrozd this might be caused by the fact that PartialFunction is a dynamic construct, being constructed at inference time https://github.com/PyCQA/astroid/blob/cab26ec5c0f300855462ff79e93b107064983f44/astroid/brain/brain_functools.py#L102 I'm not sure where the bug is, but locate_child should probably be aware of dynamic objects such as this.

BrannonKing commented 5 years ago

I'm seeing this similar error (v2.1.0):

Traceback (most recent call last):
  File "/home/brannon/Workspace/lbry/lbry-venv/bin/pylint", line 10, in <module>
    sys.exit(run_pylint())
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/pylint/__init__.py", line 20, in run_pylint
    Run(sys.argv[1:])
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/pylint/lint.py", line 1608, in __init__
    linter.check(args)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/pylint/lint.py", line 938, in check
    self._do_check(files_or_modules)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/pylint/lint.py", line 1071, in _do_check
    self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/pylint/lint.py", line 1154, in check_astroid_module
    walker.walk(ast_node)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/pylint/utils.py", line 1269, in walk
    self.walk(child)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/pylint/utils.py", line 1269, in walk
    self.walk(child)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/pylint/utils.py", line 1269, in walk
    self.walk(child)
  [Previous line repeated 1 more time]
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/pylint/utils.py", line 1266, in walk
    cb(astroid)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/pylint/checkers/typecheck.py", line 1055, in visit_call
    called, implicit_args, callable_name = _determine_callable(called)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/pylint/checkers/typecheck.py", line 461, in _determine_callable
    new = callable_obj.local_attr("__new__")[-1]
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/scoped_nodes.py", line 2279, in local_attr
    class_node = next(self.local_attr_ancestors(name, context), None)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/scoped_nodes.py", line 2230, in local_attr_ancestors
    ancestors = self.mro(context)[1:]
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/scoped_nodes.py", line 2779, in mro
    raise NotImplementedError("Could not obtain mro for old-style classes.")
NotImplementedError: Could not obtain mro for old-style classes.
BrannonKing commented 5 years ago

Here's another one (with v2.0.1):

Traceback (most recent call last):
  File "/home/brannon/Workspace/lbry/lbry-venv/bin/pylint", line 10, in <module>
    sys.exit(run_pylint())
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/pylint/__init__.py", line 20, in run_pylint
    Run(sys.argv[1:])
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/pylint/lint.py", line 1608, in __init__
    linter.check(args)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/pylint/lint.py", line 938, in check
    self._do_check(files_or_modules)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/pylint/lint.py", line 1071, in _do_check
    self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/pylint/lint.py", line 1154, in check_astroid_module
    walker.walk(ast_node)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/pylint/utils.py", line 1269, in walk
    self.walk(child)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/pylint/utils.py", line 1269, in walk
    self.walk(child)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/pylint/utils.py", line 1269, in walk
    self.walk(child)
  [Previous line repeated 1 more time]
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/pylint/utils.py", line 1266, in walk
    cb(astroid)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/pylint/checkers/typecheck.py", line 1035, in visit_call
    called = safe_infer(node.func)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/pylint/checkers/utils.py", line 1077, in safe_infer
    next(inferit)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/decorators.py", line 92, in wrapped
    res = next(generator)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/decorators.py", line 131, in raise_if_nothing_inferred
    yield next(generator)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/inference.py", line 288, in infer_attribute
    for owner in self.expr.infer(context):
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/util.py", line 148, in limit_inference
    yield from islice(iterator, size)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/context.py", line 107, in cache_generator
    for result in generator:
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/decorators.py", line 92, in wrapped
    res = next(generator)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/decorators.py", line 131, in raise_if_nothing_inferred
    yield next(generator)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/inference.py", line 309, in infer_attribute
    yield from owner.igetattr(self.attrname, context)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/bases.py", line 211, in igetattr
    yield from self._wrap_attr(attrs, context)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/bases.py", line 220, in _wrap_attr
    yield from attr.infer_call_result(self, context)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/scoped_nodes.py", line 1628, in infer_call_result
    yield from returnnode.value.infer(context)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/util.py", line 148, in limit_inference
    yield from islice(iterator, size)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/context.py", line 107, in cache_generator
    for result in generator:
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/decorators.py", line 92, in wrapped
    res = next(generator)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/decorators.py", line 131, in raise_if_nothing_inferred
    yield next(generator)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/inference.py", line 309, in infer_attribute
    yield from owner.igetattr(self.attrname, context)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/bases.py", line 202, in igetattr
    yield from _infer_stmts(self._wrap_attr(get_attr, context), context, frame=self)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/bases.py", line 125, in _infer_stmts
    for inferred in stmt.infer(context=context):
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/util.py", line 148, in limit_inference
    yield from islice(iterator, size)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/context.py", line 107, in cache_generator
    for result in generator:
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/decorators.py", line 92, in wrapped
    res = next(generator)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/bases.py", line 125, in _infer_stmts
    for inferred in stmt.infer(context=context):
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/util.py", line 148, in limit_inference
    yield from islice(iterator, size)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/context.py", line 107, in cache_generator
    for result in generator:
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/decorators.py", line 92, in wrapped
    res = next(generator)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/bases.py", line 125, in _infer_stmts
    for inferred in stmt.infer(context=context):
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/util.py", line 148, in limit_inference
    yield from islice(iterator, size)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/context.py", line 107, in cache_generator
    for result in generator:
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/decorators.py", line 92, in wrapped
    res = next(generator)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/bases.py", line 125, in _infer_stmts
    for inferred in stmt.infer(context=context):
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/util.py", line 148, in limit_inference
    yield from islice(iterator, size)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/context.py", line 107, in cache_generator
    for result in generator:
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/decorators.py", line 131, in raise_if_nothing_inferred
    yield next(generator)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/decorators.py", line 92, in wrapped
    res = next(generator)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/inference.py", line 205, in infer_call
    for callee in self.func.infer(context):
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/util.py", line 148, in limit_inference
    yield from islice(iterator, size)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/context.py", line 107, in cache_generator
    for result in generator:
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/decorators.py", line 92, in wrapped
    res = next(generator)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/bases.py", line 125, in _infer_stmts
    for inferred in stmt.infer(context=context):
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/util.py", line 148, in limit_inference
    yield from islice(iterator, size)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/context.py", line 107, in cache_generator
    for result in generator:
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/decorators.py", line 89, in wrapped
    generator = _func(node, context, **kwargs)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/inference.py", line 263, in infer_import_from
    module = self.do_import_module()
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/mixins.py", line 101, in do_import_module
    relative_only=level and level >= 1)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/scoped_nodes.py", line 602, in import_module
    return MANAGER.ast_from_module_name(absmodname)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/manager.py", line 150, in ast_from_module_name
    return self.ast_from_file(found_spec.location, modname, fallback=False)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/manager.py", line 83, in ast_from_file
    return AstroidBuilder(self).file_build(filepath, modname)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/builder.py", line 128, in file_build
    return self._post_build(module, encoding)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/builder.py", line 148, in _post_build
    self.delayed_assattr(delayed)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/builder.py", line 214, in delayed_assattr
    if not _can_assign_attr(inferred, node.attrname):
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/builder.py", line 57, in _can_assign_attr
    slots = node.slots()
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/decorators.py", line 33, in cached
    cache[func] = result = func(*args, **kwargs)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/scoped_nodes.py", line 2653, in slots
    slots = list(grouped_slots())
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/scoped_nodes.py", line 2639, in grouped_slots
    for cls in self.mro()[:-1]:
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/scoped_nodes.py", line 2732, in mro
    return self._compute_mro(context=context)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/scoped_nodes.py", line 2713, in _compute_mro
    _verify_duplicates_mro(unmerged_mro, self, context)
  File "/home/brannon/Workspace/lbry/lbry-venv/lib/python3.7/site-packages/astroid/scoped_nodes.py", line 94, in _verify_duplicates_mro
    mros=sequences, cls=cls, context=context)
astroid.exceptions.DuplicateBasesError: Duplicates found in MROs (AbstractResource), (_GenericAlias, _Final, object), (_GenericAlias, _Final, object), (_GenericAlias, _GenericAlias) for <ClassDef.AbstractResource l.75 at 0x7f488a4cb6a0>.
DanielNoord commented 2 years ago

@nickdrozd This https://github.com/PyCQA/astroid/issues/627#issuecomment-453196243 crashed with pylint right? I'm no longer seeing a crash with current main of pylint and astroid.

@adarob, @dzen or @BrannonKing If any of you is still interested in this issue. Could you try and see if this has been resolved in the latest versions?

nickdrozd commented 2 years ago

Yeah that snippet used to crash, but now it doesn't. I don't know about the original issue though. It seems like something got fixed at least.

cdce8p commented 2 years ago

The DuplicateBasesError for _GenericAlias was fixed a while ago. If the other issue can't be reproduced anymore too, let's close it. If someone still has an issue with it, please leave a comment and this can be reopened.