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

RuntimeError: dictionary changed size during iteration #8589

Closed
xujiboy opened this issue Apr 18, 2023 · 6 comments · Fixed by pylint-dev/astroid#2687
Closed

RuntimeError: dictionary changed size during iteration #8589

xujiboy opened this issue Apr 18, 2023 · 6 comments · Fixed by pylint-dev/astroid#2687
Assignees
Labels
Crash 💥 A bug that makes pylint crash Needs astroid update Needs an astroid update (probably a release too) before being mergable
Milestone

Comments

@xujiboy
Copy link

xujiboy commented Apr 18, 2023

Bug description

When parsing the following file:

import janitor
from metaflow import FlowSpec, step

class LinearFlow(FlowSpec):

    @step
    def start(self):
        self.my_var = 'hello world'
        self.next(self.a)

    @step
    def a(self):
        print('the data artifact is: %s' % self.my_var)
        self.next(self.end)

    @step
    def end(self):
        print('the data artifact is still: %s' % self.my_var)

if __name__ == '__main__':
    LinearFlow()

pylint crashed with a AstroidError and with the following stacktrace:

  • note that when there is no import of janitor then everything went fine.
Traceback (most recent call last):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/pylint/checkers/imports.py", line 858, in _get_imported_module
    return importnode.do_import_module(modname)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/_base_nodes.py", line 146, in do_import_module
    return mymodule.import_module(
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/scoped_nodes/scoped_nodes.py", line 530, in import_module
    return AstroidManager().ast_from_module_name(
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/manager.py", line 232, in ast_from_module_name
    return self.ast_from_file(found_spec.location, modname, fallback=False)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/manager.py", line 124, in ast_from_file
    return AstroidBuilder(self).file_build(filepath, modname)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/builder.py", line 145, in file_build
    return self._post_build(module, builder, encoding)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/builder.py", line 166, in _post_build
    self.add_from_names_to_locals(from_node)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/builder.py", line 223, in add_from_names_to_locals
    imported = node.do_import_module()
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/_base_nodes.py", line 146, in do_import_module
    return mymodule.import_module(
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/scoped_nodes/scoped_nodes.py", line 530, in import_module
    return AstroidManager().ast_from_module_name(
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/manager.py", line 232, in ast_from_module_name
    return self.ast_from_file(found_spec.location, modname, fallback=False)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/manager.py", line 124, in ast_from_file
    return AstroidBuilder(self).file_build(filepath, modname)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/builder.py", line 145, in file_build
    return self._post_build(module, builder, encoding)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/builder.py", line 173, in _post_build
    module = self._manager.visit_transforms(module)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/manager.py", line 95, in visit_transforms
    return self._transform.visit(node)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/transforms.py", line 89, in visit
    return self._visit(module)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/transforms.py", line 54, in _visit
    visited = self._visit_generic(value)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/transforms.py", line 61, in _visit_generic
    return [self._visit_generic(child) for child in node]
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/transforms.py", line 61, in <listcomp>
    return [self._visit_generic(child) for child in node]
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/transforms.py", line 67, in _visit_generic
    return self._visit(node)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/transforms.py", line 54, in _visit
    visited = self._visit_generic(value)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/transforms.py", line 61, in _visit_generic
    return [self._visit_generic(child) for child in node]
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/transforms.py", line 61, in <listcomp>
    return [self._visit_generic(child) for child in node]
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/transforms.py", line 67, in _visit_generic
    return self._visit(node)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/transforms.py", line 57, in _visit
    return self._transform(node)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/transforms.py", line 38, in _transform
    if predicate is None or predicate(node):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/brain/brain_namedtuple_enum.py", line 613, in _is_enum_subclass
    for klass in cls.mro()
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/scoped_nodes/scoped_nodes.py", line 3066, in mro
    return self._compute_mro(context=context)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/scoped_nodes/scoped_nodes.py", line 3035, in _compute_mro
    inferred_bases = list(self._inferred_bases(context=context))
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/scoped_nodes/scoped_nodes.py", line 3018, in _inferred_bases
    baseobj = next(
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/scoped_nodes/scoped_nodes.py", line 3018, in <genexpr>
    baseobj = next(
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/node_ng.py", line 184, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 143, in raise_if_nothing_inferred
    yield next(generator)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 112, in wrapped
    for res in _func(node, context, **kwargs):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/bases.py", line 177, in _infer_stmts
    for inf in stmt.infer(context=context):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/node_ng.py", line 184, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 143, in raise_if_nothing_inferred
    yield next(generator)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 112, in wrapped
    for res in _func(node, context, **kwargs):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/inference.py", line 334, in infer_import_from
    module = self.do_import_module()
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/_base_nodes.py", line 146, in do_import_module
    return mymodule.import_module(
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/scoped_nodes/scoped_nodes.py", line 530, in import_module
    return AstroidManager().ast_from_module_name(
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/manager.py", line 232, in ast_from_module_name
    return self.ast_from_file(found_spec.location, modname, fallback=False)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/manager.py", line 124, in ast_from_file
    return AstroidBuilder(self).file_build(filepath, modname)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/builder.py", line 145, in file_build
    return self._post_build(module, builder, encoding)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/builder.py", line 169, in _post_build
    self.delayed_assattr(delayed)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/builder.py", line 240, in delayed_assattr
    for inferred in node.expr.infer():
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/node_ng.py", line 171, in infer
    yield from self._infer(context=context, **kwargs)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 143, in raise_if_nothing_inferred
    yield next(generator)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 112, in wrapped
    for res in _func(node, context, **kwargs):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/bases.py", line 177, in _infer_stmts
    for inf in stmt.infer(context=context):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/node_ng.py", line 184, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 143, in raise_if_nothing_inferred
    yield next(generator)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 112, in wrapped
    for res in _func(node, context, **kwargs):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/bases.py", line 177, in _infer_stmts
    for inf in stmt.infer(context=context):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/node_ng.py", line 184, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 143, in raise_if_nothing_inferred
    yield next(generator)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 112, in wrapped
    for res in _func(node, context, **kwargs):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/inference.py", line 270, in infer_call
    for callee in self.func.infer(context):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/node_ng.py", line 184, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 143, in raise_if_nothing_inferred
    yield next(generator)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 112, in wrapped
    for res in _func(node, context, **kwargs):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/inference.py", line 358, in infer_attribute
    for owner in self.expr.infer(context):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/node_ng.py", line 184, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 143, in raise_if_nothing_inferred
    yield next(generator)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 112, in wrapped
    for res in _func(node, context, **kwargs):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/bases.py", line 177, in _infer_stmts
    for inf in stmt.infer(context=context):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/node_ng.py", line 184, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 143, in raise_if_nothing_inferred
    yield next(generator)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 112, in wrapped
    for res in _func(node, context, **kwargs):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/inference.py", line 304, in infer_import
    yield self.do_import_module(self.real_name(name))
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/_base_nodes.py", line 146, in do_import_module
    return mymodule.import_module(
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/scoped_nodes/scoped_nodes.py", line 530, in import_module
    return AstroidManager().ast_from_module_name(
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/manager.py", line 232, in ast_from_module_name
    return self.ast_from_file(found_spec.location, modname, fallback=False)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/manager.py", line 124, in ast_from_file
    return AstroidBuilder(self).file_build(filepath, modname)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/builder.py", line 145, in file_build
    return self._post_build(module, builder, encoding)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/builder.py", line 169, in _post_build
    self.delayed_assattr(delayed)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/builder.py", line 240, in delayed_assattr
    for inferred in node.expr.infer():
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/node_ng.py", line 171, in infer
    yield from self._infer(context=context, **kwargs)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 143, in raise_if_nothing_inferred
    yield next(generator)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 112, in wrapped
    for res in _func(node, context, **kwargs):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/bases.py", line 177, in _infer_stmts
    for inf in stmt.infer(context=context):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/node_ng.py", line 184, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 143, in raise_if_nothing_inferred
    yield next(generator)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 112, in wrapped
    for res in _func(node, context, **kwargs):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/bases.py", line 177, in _infer_stmts
    for inf in stmt.infer(context=context):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/node_ng.py", line 184, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 143, in raise_if_nothing_inferred
    yield next(generator)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 112, in wrapped
    for res in _func(node, context, **kwargs):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/inference.py", line 279, in infer_call
    yield from callee.infer_call_result(caller=self, context=callcontext)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/scoped_nodes/scoped_nodes.py", line 2291, in infer_call_result
    result = self._infer_type_call(caller, context)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/scoped_nodes/scoped_nodes.py", line 2242, in _infer_type_call
    name_node = next(caller.args[0].infer(context))
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/node_ng.py", line 184, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 143, in raise_if_nothing_inferred
    yield next(generator)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 112, in wrapped
    for res in _func(node, context, **kwargs):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/bases.py", line 177, in _infer_stmts
    for inf in stmt.infer(context=context):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/node_ng.py", line 184, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 143, in raise_if_nothing_inferred
    yield next(generator)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 112, in wrapped
    for res in _func(node, context, **kwargs):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/bases.py", line 177, in _infer_stmts
    for inf in stmt.infer(context=context):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/node_ng.py", line 184, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 143, in raise_if_nothing_inferred
    yield next(generator)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 112, in wrapped
    for res in _func(node, context, **kwargs):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/inference.py", line 270, in infer_call
    for callee in self.func.infer(context):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/node_ng.py", line 184, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 143, in raise_if_nothing_inferred
    yield next(generator)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 112, in wrapped
    for res in _func(node, context, **kwargs):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/inference.py", line 358, in infer_attribute
    for owner in self.expr.infer(context):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/node_ng.py", line 184, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 143, in raise_if_nothing_inferred
    yield next(generator)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 112, in wrapped
    for res in _func(node, context, **kwargs):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/bases.py", line 177, in _infer_stmts
    for inf in stmt.infer(context=context):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/node_ng.py", line 184, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 143, in raise_if_nothing_inferred
    yield next(generator)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/decorators.py", line 112, in wrapped
    for res in _func(node, context, **kwargs):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/inference.py", line 304, in infer_import
    yield self.do_import_module(self.real_name(name))
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/_base_nodes.py", line 146, in do_import_module
    return mymodule.import_module(
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/scoped_nodes/scoped_nodes.py", line 530, in import_module
    return AstroidManager().ast_from_module_name(
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/manager.py", line 207, in ast_from_module_name
    return self.ast_from_module(named_module, modname)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/manager.py", line 314, in ast_from_module
    return AstroidBuilder(self).module_build(module, modname)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/builder.py", line 101, in module_build
    node = self.inspect_build(module, modname=modname, path=path)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/raw_building.py", line 404, in inspect_build
    self.object_build(node, module)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/raw_building.py", line 455, in object_build
    attach_const_node(node, name, member)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/raw_building.py", line 78, in attach_const_node
    _attach_local_node(node, nodes.const_factory(value), name)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/node_classes.py", line 5641, in const_factory
    instance.postinit(_create_dict_items(value, instance))
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/astroid/nodes/node_classes.py", line 5612, in _create_dict_items
    for key, value in values.items():
RuntimeError: dictionary changed size during iteration

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

Traceback (most recent call last):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/pylint/lint/pylinter.py", line 811, in _lint_file
    check_astroid_module(module)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/pylint/lint/pylinter.py", line 1085, in check_astroid_module
    retval = self._check_astroid_module(
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/pylint/lint/pylinter.py", line 1135, in _check_astroid_module
    walker.walk(node)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/pylint/utils/ast_walker.py", line 94, in walk
    self.walk(child)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/pylint/utils/ast_walker.py", line 91, in walk
    callback(astroid)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/pylint/checkers/imports.py", line 534, in visit_import
    imported_module = self._get_imported_module(node, name)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/pylint/checkers/imports.py", line 883, in _get_imported_module
    raise astroid.AstroidError from e
astroid.exceptions.AstroidError

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

Traceback (most recent call last):
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/pylint/lint/pylinter.py", line 775, in _lint_files
    self._lint_file(fileitem, module, check_astroid_module)
  File "/home/jixux/miniconda3/envs/metaflow_test/lib/python3.10/site-packages/pylint/lint/pylinter.py", line 813, in _lint_file
    raise astroid.AstroidError from e
astroid.exceptions.AstroidError

Configuration

No response

Command used

python linear_flow.py run

Pylint output

linear_flow.py:1:0: F0002: /local/home/jixux/test/metaflow/linear_flow.py: Fatal error while checking '/local/home/jixux/test/metaflow/linear_flow.py'. Please open an issue in our bug tracker so we address this. There is a pre-filled template that you can use in '/local/home/jixux/.cache/pylint/pylint-crash-2023-04-18-16-46-18.txt'. (astroid-error)

Expected behavior

I expect pylint to run without crashing.

Pylint version

pylint 2.17.2
astroid 2.15.3
Python 3.10.0 (default, Mar  3 2022, 09:58:08) [GCC 7.5.0]

OS / Environment

Linux version 5.4.235-151.344.amzn2int.x86_64 (mockbuild@ip-10-0-51-118) (gcc version 7.3.1 20180712 (Red Hat 7.3.1-13) (GCC))

Additional dependencies

aiobotocore==2.4.2
aiohttp==3.8.3
aioitertools==0.11.0
aiosignal==1.3.1
alembic==1.9.2
astroid==2.15.3
asttokens==2.2.1
async-timeout==4.0.2
attrs==22.2.0
autopage==0.5.1
backcall==0.2.0
bigtree==0.6.7
black==22.12.0
boto3==1.24.59
botocore==1.27.59
certifi==2022.12.7
charset-normalizer==2.1.1
click==8.1.3
cliff==4.1.0
cmaes==0.9.1
cmd2==2.4.2
colorlog==6.7.0
contourpy==1.0.6
cycler==0.11.0
Cython==0.29.33
decorator==5.1.1
dill==0.3.6
et-xmlfile==1.1.0
exceptiongroup==1.1.0
executing==1.2.0
fonttools==4.38.0
frozenlist==1.3.3
fsspec==2022.11.0
hdbscan==0.8.29
idna==3.4
importlib-metadata==4.13.0
iniconfig==2.0.0
ipython==8.8.0
isort==5.11.4
jedi==0.18.2
Jinja2==3.1.2
jmespath==1.0.1
joblib==1.2.0
kiwisolver==1.4.4
lazy-object-proxy==1.9.0
lazy_loader==0.1rc2
lightgbm==3.3.3
llvmlite==0.39.1
Mako==1.2.4
markdown-it-py==2.1.0
MarkupSafe==2.1.1
matplotlib==3.6.2
matplotlib-inline==0.1.6
mccabe==0.7.0
mdit-py-plugins==0.3.3
mdurl==0.1.2
metaflow==2.7.18
multidict==6.0.4
multipledispatch==0.6.0
mypy-extensions==0.4.3
natsort==8.2.0
nbclient==0.7.2
networkx==3.0
numba==0.56.4
numpy==1.23.5
nx-altair==0.1.6
openpyxl==3.0.10
optuna==3.0.3
packaging==23.0
pandas==1.5.1
pandas-flavor==0.3.0
parso==0.8.3
pathspec==0.10.3
pbr==5.11.1
pexpect==4.8.0
pickleshare==0.7.5
Pillow==9.4.0
platformdirs==2.6.2
plotly==5.11.0
pluggy==1.0.0
prettytable==3.6.0
prompt-toolkit==3.0.36
ptyprocess==0.7.0
pure-eval==0.2.2
pyarrow==10.0.1
pydot==1.4.2
pyemd==0.5.1
Pygments==2.14.0
pyjanitor==0.24.0
pylint==2.17.2
pynndescent==0.5.8
pyparsing==3.0.9
pyperclip==1.8.2
pytest==7.2.0
python-dateutil==2.8.2
python-dotenv==0.21.0
pytz==2022.6
PyYAML==6.0
requests==2.28.1
s3fs==2022.11.0
s3transfer==0.6.0
scikit-learn==1.2.1
scipy==1.10.1
seaborn==0.12.2
six==1.16.0
SQLAlchemy==1.3.19
stack-data==0.6.2
stevedore==4.1.1
tenacity==8.1.0
threadpoolctl==3.1.0
toml==0.10.2
tomli==2.0.1
tomlkit==0.11.6
toolz==0.12.0
tqdm==4.64.1
traitlets==5.8.1
typing_extensions==4.4.0
umap-learn==0.5.3
urllib3==1.26.13
vega-datasets==0.9.0
watermark==2.3.1
wcwidth==0.2.6
wrapt==1.14.1
xarray==2022.12.0
yarl==1.8.2
zipp==3.11.0

@xujiboy xujiboy added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Apr 18, 2023
@DanielNoord
Copy link
Collaborator

I checked the code and have no idea how the following code can cause that issue:

def _create_dict_items(
    values: Mapping[Any, Any], node: Dict
) -> list[tuple[SuccessfulInferenceResult, SuccessfulInferenceResult]]:
    """Create a list of node pairs to function as the items of a new dict node."""
    elements: list[tuple[SuccessfulInferenceResult, SuccessfulInferenceResult]] = []
    for key, value in values.items():
        key_node = const_factory(key)
        key_node.parent = node
        value_node = const_factory(value)
        value_node.parent = node
        elements.append((key_node, value_node))
    return elements

I might be dumb but the dictionary doesn't seem to change size here.

@Pierre-Sassoulas Pierre-Sassoulas added Crash 💥 A bug that makes pylint crash Needs investigation 🔬 A bug or crash where it's not immediately obvious what is happenning and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Apr 24, 2023
@jacobtylerwalls
Copy link
Member

Thanks for the report, we always like to address crashes when we can reproduce them. Unfortunately, with a fresh venv, and with the pylint/astroid/python versions reported, and with as many of the packages installed as practical (see below), I can't reproduce the crash. Feel free to reopen if you have a reproducer from a fresh venv. Thanks.

pip reports the following package inconsistency trying to reproduce your environment:

ERROR: Cannot install -r requirements.txt (line 34), -r requirements.txt (line 47), -r requirements.txt (line 68) and scipy==1.10.1 because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested scipy==1.10.1
    hdbscan 0.8.29 depends on scipy>=1.0
    lightgbm 3.3.3 depends on scipy
    optuna 3.0.3 depends on scipy<1.9.0 and >=1.7.0

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies

@jacobtylerwalls jacobtylerwalls closed this as not planned Won't fix, can't repro, duplicate, stale May 18, 2023
@jacobtylerwalls jacobtylerwalls added Cannot reproduce 🤷 and removed Needs investigation 🔬 A bug or crash where it's not immediately obvious what is happenning labels May 18, 2023
@jacobtylerwalls
Copy link
Member

Reported again in #8928.

@jacobtylerwalls jacobtylerwalls changed the title Crash when importing janitor in a metaflow RuntimeError: dictionary changed size during iteration Aug 5, 2023
@xujiboy
Copy link
Author

xujiboy commented Aug 14, 2023

Just want to follow up and FYI that the behavior can be reproduced with this minimal requirement.txt:

metaflow
pyjanitor==0.24.0

However, the error went away if I upgrade pyjanitor to the latest release 0.25.0.

@jacobtylerwalls jacobtylerwalls added Needs investigation 🔬 A bug or crash where it's not immediately obvious what is happenning and removed Cannot reproduce 🤷 labels Aug 14, 2023
@Pierre-Sassoulas Pierre-Sassoulas added this to the 3.0.0 milestone Aug 16, 2023
@Pierre-Sassoulas Pierre-Sassoulas removed this from the 3.0.0 milestone Sep 25, 2023
@mjimlittle
Copy link

Run into the same issue today as well.

The strange thing is, this is only happening in the CI checks in one of our company's repos.
When executing the same thing locally Pylint works as expected.

@aatle
Copy link
Contributor

aatle commented Jan 17, 2025

Hello, my PR at pygame-community/pygame-ce#3249 fails CI checks consistently with a similar error.
This PR introduced some import changes, e.g. adding:

try:
    if numpy_missing:
        # Always fails here. Need the error message for MissingModule.reason
        import numpy  # pylint: disable=ungrouped-imports
    # Check that module dependencies are not missing, or get error message
    import pygame.pixelcopy  # pylint: disable=ungrouped-imports
except (ImportError, OSError):
    surfarray = MissingModule("surfarray", urgent=0)
else:
    surfarray = lazy_import("surfarray")

See full diff here.

After some investigation, I was able to reproduce it locally.

Further investigation revealed that a specific configuration line is connected to the error.
Removing/commenting this line in setup.cfg fixes the crash:

extension-pkg-whitelist=pygame

To reproduce:

  1. Clone https://github.com/aatle/pygame-ce/tree/lazy-numpy branch locally
  2. Create venv with python -m venv .venv
  3. With the venv interpreter, run python -m pip install .
  4. Run python dev.py lint, which both installs pylint and checks the code. It errors.
    Using pip install pylint instead does not lead to the error.
    All subsequent pylint src_py/__init__.py commands fail, even when switching back to main branch or modifying __init__.py, and even
    after reinstalling pylint using pip, not reinstalling dependencies.
Full setup.cfg file:
[tox:tox]
envlist = py{39,310,311,312,313}
skip_missing_interpreters = True
skipsdist = True

[testenv]
deps =
    numpy
setenv =
    SDL_AUDIODRIVER=disk
    SDL_VIDEODRIVER=dummy
passenv =
    PORTMIDI_INC_PORTTIME
commands =
    python -m buildconfig -auto
    pip install .
    python -m pygame.tests

[options.entry_points]
pyinstaller40 =
	hook-dirs = pygame.__pyinstaller:get_hook_dirs
briefcase.boostraps =
    pygame_ce = pygame.__briefcase.pygame_ce:PygameCEGuiBootstrap

[isort]
include_trailing_comma = True
known_first_party = pygame
known_third_party = numpy, distutils, setuptools, sphinx
line_length = 88
multi_line_output = 3
src_paths = src_py

[pylint.MESSAGES CONTROL]
extension-pkg-whitelist=pygame
enable=
    use-symbolic-message-instead,

disable=
    attribute-defined-outside-init,
    broad-except,
    duplicate-code,
    empty-docstring,
    fixme,
    global-statement,
    global-variable-undefined,
    import-error,
    import-outside-toplevel,
    invalid-name,
    missing-docstring,
    no-member,
    protected-access,
    raise-missing-from,
    redefined-builtin,
    redefined-outer-name,
    super-with-arguments,
    too-few-public-methods,
    too-many-arguments,
    too-many-branches,
    too-many-instance-attributes,
    too-many-lines,
    too-many-locals,
    undefined-all-variable,
    undefined-variable,
    unused-import, # False positive because there are no __all__ sometime.
    useless-object-inheritance,
    wrong-import-order,
    wrong-import-position,
Environment: Windows 11
$ pylint --version
pylint 3.3.1
astroid 3.3.8
Python 3.13.0 (tags/v3.13.0:60403a5, Oct  7 2024, 09:38:07) [MSC v.1941 64 bit (AMD64)]
$ pip list
Package      Version
------------ ----------
astroid      3.3.8
colorama     0.4.6
dill         0.3.9
isort        5.13.2
mccabe       0.7.0
numpy        2.2.1
pip          24.2
platformdirs 4.3.6
pygame-ce    2.5.3.dev1
pylint       3.3.1
tomlkit      0.13.2
Full crash traceback:
$ python dev.py lint
[dev.py] Using python 'C:\Users\user\development\pygame-ce\.venv\Scripts\python.exe'
[dev.py] Checking pip version
[dev.py] > C:\Users\user\development\pygame-ce\.venv\Scripts\python.exe -m pip -V
pip 24.2 from C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\pip (python 3.13)

[dev.py] Determined pip version: 24.2
[dev.py] Installing dependencies
[dev.py] > C:\Users\user\development\pygame-ce\.venv\Scripts\python.exe -m pip install -v pylint==3.3.1 numpy
Using pip 24.2 from C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\pip (python 3.13)
  Link requires a different Python (3.13.0 not in: '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <3.7'): https://files.pythonhosted.org/packages/36/3b/fa4025a424adafd85c6195001b1c130ecb8d8b30784a1c4cb68e7b5e5ae7/pylint-1.9.5-py2.py3-none-any.whl (from https://pypi.org/simple/pylint/) (requires-python:>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <3.7)
  Link requires a different Python (3.13.0 not in: '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <3.7'): https://files.pythonhosted.org/packages/3f/0b/4e7eeab1abf594b447385a340593c1a4244cdf8e54a78edcae1e2756d6fb/pylint-1.9.5.tar.gz (from https://pypi.org/simple/pylint/) (requires-python:>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <3.7)
Collecting pylint==3.3.1
  Obtaining dependency information for pylint==3.3.1 from https://files.pythonhosted.org/packages/4d/11/4a3f814eee14593f3cfcf7046bc765bf1646d5c88132c08c45310fc7d85f/pylint-3.3.1-py3-none-any.whl.metadata
  Using cached pylint-3.3.1-py3-none-any.whl.metadata (12 kB)
  Link requires a different Python (3.13.0 not in: '>=3.7,<3.11'): https://files.pythonhosted.org/packages/3a/be/650f9c091ef71cb01d735775d554e068752d3ff63d7943b26316dc401749/numpy-1.21.2.zip (from https://pypi.org/simple/numpy/) (requires-python:>=3.7,<3.11)
  Link requires a different Python (3.13.0 not in: '>=3.7,<3.11'): https://files.pythonhosted.org/packages/5f/d6/ad58ded26556eaeaa8c971e08b6466f17c4ac4d786cd3d800e26ce59cc01/numpy-1.21.3.zip (from https://pypi.org/simple/numpy/) (requires-python:>=3.7,<3.11)
  Link requires a different Python (3.13.0 not in: '>=3.7,<3.11'): https://files.pythonhosted.org/packages/fb/48/b0708ebd7718a8933f0d3937513ef8ef2f4f04529f1f66ca86d873043921/numpy-1.21.4.zip (from https://pypi.org/simple/numpy/) (requires-python:>=3.7,<3.11)
  Link requires a different Python (3.13.0 not in: '>=3.7,<3.11'): https://files.pythonhosted.org/packages/c2/a8/a924a09492bdfee8c2ec3094d0a13f2799800b4fdc9c890738aeeb12c72e/numpy-1.21.5.zip (from https://pypi.org/simple/numpy/) (requires-python:>=3.7,<3.11)
  Link requires a different Python (3.13.0 not in: '>=3.7,<3.11'): https://files.pythonhosted.org/packages/45/b7/de7b8e67f2232c26af57c205aaad29fe17754f793404f59c8a730c7a191a/numpy-1.21.6.zip (from https://pypi.org/simple/numpy/) (requires-python:>=3.7,<3.11)
  Link requires a different Python (3.13.0 not in: '<3.13,>=3.9'): https://files.pythonhosted.org/packages/55/b3/b13bce39ba82b7398c06d10446f5ffd5c07db39b09bd37370dc720c7951c/numpy-1.26.0.tar.gz (from https://pypi.org/simple/numpy/) (requires-python:<3.13,>=3.9)
  Link requires a different Python (3.13.0 not in: '<3.13,>=3.9'): https://files.pythonhosted.org/packages/78/23/f78fd8311e0f710fe1d065d50b92ce0057fe877b8ed7fd41b28ad6865bfc/numpy-1.26.1.tar.gz (from https://pypi.org/simple/numpy/) (requires-python:<3.13,>=3.9)
Collecting numpy
  Obtaining dependency information for numpy from https://files.pythonhosted.org/packages/44/be/0e5cd009d2162e4138d79a5afb3b5d2341f0fe4777ab6e675aa3d4a42e21/numpy-2.2.1-cp313-cp313-win_amd64.whl.metadata
  Using cached numpy-2.2.1-cp313-cp313-win_amd64.whl.metadata (60 kB)
Collecting platformdirs>=2.2.0 (from pylint==3.3.1)
  Obtaining dependency information for platformdirs>=2.2.0 from https://files.pythonhosted.org/packages/3c/a6/bc1012356d8ece4d66dd75c4b9fc6c1f6650ddd5991e421177d9f8f671be/platformdirs-4.3.6-py3-none-any.whl.metadata
  Using cached platformdirs-4.3.6-py3-none-any.whl.metadata (11 kB)
Collecting astroid<=3.4.0-dev0,>=3.3.4 (from pylint==3.3.1)
  Obtaining dependency information for astroid<=3.4.0-dev0,>=3.3.4 from https://files.pythonhosted.org/packages/07/28/0bc8a17d6cd4cc3c79ae41b7105a2b9a327c110e5ddd37a8a27b29a5c8a2/astroid-3.3.8-py3-none-any.whl.metadata
  Using cached astroid-3.3.8-py3-none-any.whl.metadata (4.5 kB)
Collecting isort!=5.13.0,<6,>=4.2.5 (from pylint==3.3.1)
  Obtaining dependency information for isort!=5.13.0,<6,>=4.2.5 from https://files.pythonhosted.org/packages/d1/b3/8def84f539e7d2289a02f0524b944b15d7c75dab7628bedf1c4f0992029c/isort-5.13.2-py3-none-any.whl.metadata
  Using cached isort-5.13.2-py3-none-any.whl.metadata (12 kB)
Collecting mccabe<0.8,>=0.6 (from pylint==3.3.1)
  Obtaining dependency information for mccabe<0.8,>=0.6 from https://files.pythonhosted.org/packages/27/1a/1f68f9ba0c207934b35b86a8ca3aad8395a3d6dd7921c0686e23853ff5a9/mccabe-0.7.0-py2.py3-none-any.whl.metadata
  Using cached mccabe-0.7.0-py2.py3-none-any.whl.metadata (5.0 kB)
Collecting tomlkit>=0.10.1 (from pylint==3.3.1)
  Obtaining dependency information for tomlkit>=0.10.1 from https://files.pythonhosted.org/packages/f9/b6/a447b5e4ec71e13871be01ba81f5dfc9d0af7e473da256ff46bc0e24026f/tomlkit-0.13.2-py3-none-any.whl.metadata
  Using cached tomlkit-0.13.2-py3-none-any.whl.metadata (2.7 kB)
Collecting dill>=0.3.6 (from pylint==3.3.1)
  Obtaining dependency information for dill>=0.3.6 from https://files.pythonhosted.org/packages/46/d1/e73b6ad76f0b1fb7f23c35c6d95dbc506a9c8804f43dda8cb5b0fa6331fd/dill-0.3.9-py3-none-any.whl.metadata
  Using cached dill-0.3.9-py3-none-any.whl.metadata (10 kB)
Collecting colorama>=0.4.5 (from pylint==3.3.1)
  Obtaining dependency information for colorama>=0.4.5 from https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl.metadata
  Using cached colorama-0.4.6-py2.py3-none-any.whl.metadata (17 kB)
Using cached pylint-3.3.1-py3-none-any.whl (521 kB)
Using cached numpy-2.2.1-cp313-cp313-win_amd64.whl (12.6 MB)
Using cached astroid-3.3.8-py3-none-any.whl (275 kB)
Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Using cached dill-0.3.9-py3-none-any.whl (119 kB)
Using cached isort-5.13.2-py3-none-any.whl (92 kB)
Using cached mccabe-0.7.0-py2.py3-none-any.whl (7.3 kB)
Using cached platformdirs-4.3.6-py3-none-any.whl (18 kB)
Using cached tomlkit-0.13.2-py3-none-any.whl (37 kB)
Installing collected packages: tomlkit, platformdirs, numpy, mccabe, isort, dill, colorama, astroid, pylint
Successfully installed astroid-3.3.8 colorama-0.4.6 dill-0.3.9 isort-5.13.2 mccabe-0.7.0 numpy-2.2.1 platformdirs-4.3.6 pylint-3.3.1 tomlkit-0.13.2

[notice] A new release of pip is available: 24.2 -> 24.3.1
[notice] To update, run: python.exe -m pip install --upgrade pip
[dev.py] Linting code (with pylint)
[dev.py] > C:\Users\user\development\pygame-ce\.venv\Scripts\python.exe -m pylint src_py docs
Traceback (most recent call last):
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\pylint\lint\pylinter.py", line 976, in get_ast
    return MANAGER.ast_from_file(filepath, modname, source=True)
           ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\manager.py", line 166, in ast_from_file
    return AstroidBuilder(self).file_build(filepath, modname)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\builder.py", line 145, in file_build
    return self._post_build(module, builder, encoding)
           ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\builder.py", line 169, in _post_build
    self.delayed_assattr(delayed)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\builder.py", line 243, in delayed_assattr
    for inferred in node.expr.infer():
                    ~~~~~~~~~~~~~~~^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\nodes\node_ng.py", line 168, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
                     ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\decorators.py", line 86, in inner
    yield next(generator)
          ~~~~^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\decorators.py", line 49, in wrapped
    for res in _func(node, context, **kwargs):
               ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\bases.py", line 177, in _infer_stmts
    for inf in stmt.infer(context=context):
               ~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\nodes\node_ng.py", line 168, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
                     ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\decorators.py", line 86, in inner
    yield next(generator)
          ~~~~^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\decorators.py", line 49, in wrapped
    for res in _func(node, context, **kwargs):
               ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\bases.py", line 177, in _infer_stmts
    for inf in stmt.infer(context=context):
               ~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\nodes\node_ng.py", line 168, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
                     ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\decorators.py", line 86, in inner
    yield next(generator)
          ~~~~^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\decorators.py", line 49, in wrapped
    for res in _func(node, context, **kwargs):
               ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\nodes\node_classes.py", line 3724, in _infer_subscript
    for value in self.value.infer(context):
                 ~~~~~~~~~~~~~~~~^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\nodes\node_ng.py", line 168, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
                     ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\decorators.py", line 86, in inner
    yield next(generator)
          ~~~~^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\decorators.py", line 49, in wrapped
    for res in _func(node, context, **kwargs):
               ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\nodes\node_classes.py", line 1091, in _infer_attribute
    for owner in node.expr.infer(context):
                 ~~~~~~~~~~~~~~~^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\nodes\node_ng.py", line 168, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
                     ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\decorators.py", line 86, in inner
    yield next(generator)
          ~~~~^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\decorators.py", line 49, in wrapped
    for res in _func(node, context, **kwargs):
               ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\bases.py", line 177, in _infer_stmts
    for inf in stmt.infer(context=context):
               ~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\nodes\node_ng.py", line 168, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
                     ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\decorators.py", line 86, in inner
    yield next(generator)
          ~~~~^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\decorators.py", line 49, in wrapped
    for res in _func(node, context, **kwargs):
               ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\nodes\node_classes.py", line 3194, in _infer
    yield self.do_import_module(self.real_name(name))
          ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\nodes\_base_nodes.py", line 168, in do_import_module
    return mymodule.import_module(
           ~~~~~~~~~~~~~~~~~~~~~~^
        modname,
        ^^^^^^^^
    ...<2 lines>...
        use_cache=use_cache,
        ^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\nodes\scoped_nodes\scoped_nodes.py", line 462, in import_module
    return AstroidManager().ast_from_module_name(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        absmodname, use_cache=use_cache
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\manager.py", line 251, in ast_from_module_name
    return self.ast_from_module(named_module, modname)
           ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\manager.py", line 356, in ast_from_module
    return AstroidBuilder(self).module_build(module, modname)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\builder.py", line 101, in module_build
    node = self.inspect_build(module, modname=modname, path=path)
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\raw_building.py", line 463, in inspect_build
    self.object_build(node, module)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\raw_building.py", line 514, in object_build
    attach_const_node(node, name, member)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\raw_building.py", line 77, in attach_const_node
    _attach_local_node(node, nodes.const_factory(value), name)
                             ~~~~~~~~~~~~~~~~~~~^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\nodes\node_classes.py", line 5543, in const_factory
    instance.postinit(_create_dict_items(value, instance))
                      ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "C:\Users\user\development\pygame-ce\.venv\Lib\site-packages\astroid\nodes\node_classes.py", line 5502, in _create_dict_items
    for key, value in values.items():
                      ~~~~~~~~~~~~^^
RuntimeError: dictionary changed size during iteration
************* Module src_py
src_py\__init__.py:1:0: F0002: src_py\__init__.py: Fatal error while checking 'src_py\__init__.py'. Please open an issue in our bug tracker so we address this. There is a pre-filled template that you can use in 'C:\Users\user\AppData\Local\pylint\pylint\Cache\pylint-crash-2025-01-16-19-57-59.txt'. (astroid-error)

--------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 10.00/10, -10.00)

@jacobtylerwalls jacobtylerwalls added Needs astroid update Needs an astroid update (probably a release too) before being mergable and removed Needs investigation 🔬 A bug or crash where it's not immediately obvious what is happenning labels Feb 16, 2025
@jacobtylerwalls jacobtylerwalls added this to the 3.3.5 milestone Feb 19, 2025
luketainton pushed a commit to luketainton/webexmemebot that referenced this issue Mar 9, 2025
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [astroid](https://github.com/pylint-dev/astroid) | project.dependencies | patch | `<=3.3.8` -> `<=3.3.9` |

---

### Release Notes

<details>
<summary>pylint-dev/astroid (astroid)</summary>

### [`v3.3.9`](https://github.com/pylint-dev/astroid/blob/HEAD/ChangeLog#Whats-New-in-astroid-339)

[Compare Source](pylint-dev/astroid@v3.3.8...v3.3.9)

\============================
Release date: 2025-03-09

-   Fix crash when `sys.modules` contains lazy loader objects during checking.

    Closes [#&#8203;2686](pylint-dev/astroid#2686)
    Closes [pylint-dev/pylint#8589](pylint-dev/pylint#8589)

-   Upload release assets to PyPI via Trusted Publishing.

    Refs [pylint-dev/pylint#10256](pylint-dev/pylint#10256)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xOTEuNCIsInVwZGF0ZWRJblZlciI6IjM5LjE5MS40IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: https://git.tainton.uk/repos/webexmemebot/pulls/472
Reviewed-by: Luke Tainton <luke@tainton.uk>
Co-authored-by: Renovate [BOT] <renovate-bot@git.tainton.uk>
Co-committed-by: Renovate [BOT] <renovate-bot@git.tainton.uk>
luketainton pushed a commit to luketainton/pypilot that referenced this issue Mar 9, 2025
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [astroid](https://github.com/pylint-dev/astroid) | project.dependencies | patch | `==3.3.8` -> `==3.3.9` |

---

### Release Notes

<details>
<summary>pylint-dev/astroid (astroid)</summary>

### [`v3.3.9`](https://github.com/pylint-dev/astroid/blob/HEAD/ChangeLog#Whats-New-in-astroid-339)

[Compare Source](pylint-dev/astroid@v3.3.8...v3.3.9)

\============================
Release date: 2025-03-09

-   Fix crash when `sys.modules` contains lazy loader objects during checking.

    Closes [#&#8203;2686](pylint-dev/astroid#2686)
    Closes [pylint-dev/pylint#8589](pylint-dev/pylint#8589)

-   Upload release assets to PyPI via Trusted Publishing.

    Refs [pylint-dev/pylint#10256](pylint-dev/pylint#10256)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xOTEuNCIsInVwZGF0ZWRJblZlciI6IjM5LjE5MS40IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: https://git.tainton.uk/repos/pypilot/pulls/314
Reviewed-by: Luke Tainton <luke@tainton.uk>
Co-authored-by: Renovate [BOT] <renovate-bot@git.tainton.uk>
Co-committed-by: Renovate [BOT] <renovate-bot@git.tainton.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Crash 💥 A bug that makes pylint crash Needs astroid update Needs an astroid update (probably a release too) before being mergable
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants