-
-
Notifications
You must be signed in to change notification settings - Fork 307
Closed
PennyDreadfulMTG/Penny-Dreadful-Tools
#8447Description
Steps to reproduce
This issue is directly linked to pylint-dev/pylint#4093
- Write the following module:
from ordered_set import OrderedSet
class RegistryOrderedSet:
def __init__(self, clazz, type_name="Object"):
self._objects_dict = defaultdict(OrderedSet)
- Lint it
Current behavior
Traceback (most recent call last):
File "/home/peillexg/PROGRAMMATION/Python/astroid/astroid/decorators.py", line 34, in cached
return cache[func]
KeyError: <bound method ClassDef.slots of <ClassDef.OrderedSet l.55 at 0x7f2517b98dc0>>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/peillexg/PROGRAMMATION/Python/pylint_sandbox/bug_pylint_4093/test/bin/pylint", line 7, in <module>
exec(compile(f.read(), __file__, 'exec'))
File "/home/peillexg/PROGRAMMATION/Python/pylint/bin/pylint", line 5, in <module>
run_pylint()
File "/home/peillexg/PROGRAMMATION/Python/pylint/pylint/__init__.py", line 22, in run_pylint
PylintRun(sys.argv[1:])
File "/home/peillexg/PROGRAMMATION/Python/pylint/pylint/lint/run.py", line 358, in __init__
linter.check(args)
File "/home/peillexg/PROGRAMMATION/Python/pylint/pylint/lint/pylinter.py", line 862, in check
self._check_files(
File "/home/peillexg/PROGRAMMATION/Python/pylint/pylint/lint/pylinter.py", line 896, in _check_files
self._check_file(get_ast, check_astroid_module, name, filepath, modname)
File "/home/peillexg/PROGRAMMATION/Python/pylint/pylint/lint/pylinter.py", line 922, in _check_file
check_astroid_module(ast_node)
File "/home/peillexg/PROGRAMMATION/Python/pylint/pylint/lint/pylinter.py", line 1054, in check_astroid_module
retval = self._check_astroid_module(
File "/home/peillexg/PROGRAMMATION/Python/pylint/pylint/lint/pylinter.py", line 1099, in _check_astroid_module
walker.walk(ast_node)
File "/home/peillexg/PROGRAMMATION/Python/pylint/pylint/utils/ast_walker.py", line 75, in walk
self.walk(child)
File "/home/peillexg/PROGRAMMATION/Python/pylint/pylint/utils/ast_walker.py", line 72, in walk
callback(astroid)
File "/home/peillexg/PROGRAMMATION/Python/pylint/pylint/checkers/variables.py", line 1182, in visit_importfrom
module = node.do_import_module(name_parts[0])
File "/home/peillexg/PROGRAMMATION/Python/astroid/astroid/mixins.py", line 99, in do_import_module
return mymodule.import_module(
File "/home/peillexg/PROGRAMMATION/Python/astroid/astroid/scoped_nodes.py", line 646, in import_module
return MANAGER.ast_from_module_name(absmodname)
File "/home/peillexg/PROGRAMMATION/Python/astroid/astroid/manager.py", line 191, in ast_from_module_name
return self.ast_from_file(found_spec.location, modname, fallback=False)
File "/home/peillexg/PROGRAMMATION/Python/astroid/astroid/manager.py", line 100, in ast_from_file
return AstroidBuilder(self).file_build(filepath, modname)
File "/home/peillexg/PROGRAMMATION/Python/astroid/astroid/builder.py", line 139, in file_build
return self._post_build(module, encoding)
File "/home/peillexg/PROGRAMMATION/Python/astroid/astroid/builder.py", line 159, in _post_build
self.delayed_assattr(delayed)
File "/home/peillexg/PROGRAMMATION/Python/astroid/astroid/builder.py", line 235, in delayed_assattr
if not _can_assign_attr(inferred, node.attrname):
File "/home/peillexg/PROGRAMMATION/Python/astroid/astroid/builder.py", line 60, in _can_assign_attr
slots = node.slots()
File "/home/peillexg/PROGRAMMATION/Python/astroid/astroid/decorators.py", line 36, in cached
cache[func] = result = func(*args, **kwargs)
File "/home/peillexg/PROGRAMMATION/Python/astroid/astroid/scoped_nodes.py", line 2838, in slots
slots = list(grouped_slots())
File "/home/peillexg/PROGRAMMATION/Python/astroid/astroid/scoped_nodes.py", line 2823, in grouped_slots
for cls in self.mro()[:-1]:
File "/home/peillexg/PROGRAMMATION/Python/astroid/astroid/scoped_nodes.py", line 2909, in mro
return self._compute_mro(context=context)
File "/home/peillexg/PROGRAMMATION/Python/astroid/astroid/scoped_nodes.py", line 2898, in _compute_mro
unmerged_mro = list(clean_duplicates_mro(unmerged_mro, self, context))
File "/home/peillexg/PROGRAMMATION/Python/astroid/astroid/scoped_nodes.py", line 110, in clean_duplicates_mro
raise exceptions.DuplicateBasesError(
astroid.exceptions.DuplicateBasesError: Duplicates found in MROs (OrderedSet), (_GenericAlias, _Final, object), (_GenericAlias, _Final, object), (_GenericAlias, _GenericAlias) for <ClassDef.OrderedSet l.55 at 0x7f2517b98dc0>
Expected behavior
No error. It was the case with astroid 2.4.2. A bisection leads to commit 7f1d513.
python -c "from astroid import __pkginfo__; print(__pkginfo__.version)" output
2.5
Metadata
Metadata
Assignees
Labels
No labels