-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Comments
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. |
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:
|
Reported again in #8928. |
janitor
in a metaflow
Just want to follow up and FYI that the behavior can be reproduced with this minimal requirement.txt:
However, the error went away if I upgrade |
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. |
Hello, my PR at pygame-community/pygame-ce#3249 fails CI checks consistently with a similar error. 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.
To reproduce:
Full setup.cfg file:
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:
|
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 [#​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>
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 [#​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>
Bug description
When parsing the following file:
pylint crashed with a
AstroidError
and with the following stacktrace:janitor
then everything went fine.Configuration
No response
Command used
Pylint output
Expected behavior
I expect pylint to run without crashing.
Pylint version
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
The text was updated successfully, but these errors were encountered: