Open q-wertz opened 1 year ago
Could you test this with the latest version on the astroid 2.12.x
versions? So no 2.13.x
?
Using
pylint 2.15.10
astroid 2.12.13
Python 3.10.8 (main, Nov 1 2022, 14:18:21) [GCC 12.2.0]
I get the same behavior…
I'm not able to reproduce this 🤔
Some other things that interfere with the default logging behavior (maybe it helps)
# See https://docs.python.org/3/library/logging.html#logging.captureWarnings
logging.captureWarnings(capture=True)
haggis.logs.add_trace_level()
But all of these things happen at runtime and thus should not interfere with pylint, correct?
It depends on whether they happen at import time. pylint
imports modules as part of its analysis.
Notice the function referred to in the traceback comes from the haggis library: https://github.com/madphysicist/haggis/blob/ed2b3ff521c7e5629deaf8cb045cdd95b85920f9/src/haggis/logs.py#L464
Notice the function referred to in the traceback comes from the haggis library: https://github.com/madphysicist/haggis/blob/ed2b3ff521c7e5629deaf8cb045cdd95b85920f9/src/haggis/logs.py#L464
Ah thanks. I thought as as in the stack trace there is never a reference to haggis it is something internal and not the one from there… Do you think I have to open an issue there or does this have to be fixed in Astroid/pylint?
Still needs someone to do some investigation: either there is something we can fix in astroid, or there's not (because it's too hard to deal with how monkey-patched this situation is). In the latter case, we could consider catching the AstroidError in pylint, again, if it's easy enough to tell this scenario apart from the generic something-went-wrong-in-astroid in which we don't want to have a wide, lazy catch for everything.
Not sure if it's reasonable to handle conditionally defined function in astroid. We have a hard time with control flow already, and this is one step above it. Also how would we differentiate between unexpected astroid error and unexpected plugin error ? Checking the traceback programmatically for "pure astroidness" ?
The problem currently is, that it completely crashes pylint (for that file) at that point and the result code quality of the whole project is set to 0.0…
Right, for that reason I think we need to leave this open for a little investigation.
Predates 3.0, suggesting we remove the blocker label.
Bug description
Pylint crashes in a quite complex scenario when testing the whole project. Could not really reproduce it in a minimal example.
The strange thing is, that it seems to have problems with the
logging
library. When I switchwarning(…)
to something else it seems to work fine.When only testing the file that fails, there is no crash...
Configuration
No response
Command used
Pylint output
Expected behavior
_log.warning("test")
and_log.debug("test")
Pylint version
OS / Environment
Manjaro
Additional dependencies
aiohttp==3.8.3 aiosignal==1.3.1 alabaster==0.7.12 altair==4.2.0 appdirs==1.4.4 astroid==2.13.2 asttokens==2.2.1 async-timeout==4.0.2 attrs==22.2.0 Babel==2.11.0 backcall==0.2.0 bcrypt==4.0.1 beautifulsoup4==4.11.1 branca==0.6.0 cartes==0.7.4 Cartopy==0.20.3 certifi==2022.12.7 cffi==1.15.1 charset-normalizer==2.1.1 click==8.1.3 click-plugins==1.1.1 cligj==0.7.2 coloredlogs==15.0.1 comm==0.1.2 commonmark==0.9.1 contourpy==1.0.6 coordinate-magic==0.3.6 coverage==6.5.0 cramjam==2.6.2 cryptography==39.0.0 cycler==0.11.0 debugpy==1.6.5 decorator==5.1.1 dill==0.3.6 docutils==0.17.1 entrypoints==0.4 exceptiongroup==1.1.0 executing==1.2.0 fastparquet==2022.12.0 Fiona==1.8.22 flake8==6.0.0 flake8-codeclimate==0.3.0 flatbuffers==23.1.4 folium==0.13.0 fonttools==4.38.0 frozenlist==1.3.3 fsspec==2022.11.0 geopandas==0.12.2 gitdb==4.0.10 GitPython==3.1.30 haggis==0.8.0 humanfriendly==10.0 idna==3.4 imagesize==1.4.1 iniconfig==2.0.0 ipykernel==6.20.1 ipyleaflet==0.17.2 ipython==8.8.0 ipywidgets==8.0.4 isort==5.11.4 jedi==0.18.2 Jinja2==3.1.2 jsonschema==4.17.3 jupyter_client==7.4.8 jupyter_core==5.1.3 jupyterlab-widgets==3.0.5 kiwisolver==1.4.4 lazy-object-proxy==1.9.0 lxml==4.9.2 MarkupSafe==2.1.1 matplotlib==3.6.2 matplotlib-inline==0.1.6 mccabe==0.7.0 memray==1.5.0 metar==1.9.0 mpmath==1.2.1 multidict==6.0.4 munch==2.5.0 mypy==0.991 mypy-extensions==0.4.3 nest-asyncio==1.5.6 networkx==3.0 numpy==1.24.1 onnxruntime==1.13.1 openap==1.3 packaging==23.0 pandas==1.5.2 pandas-stubs==1.5.2.230105 paramiko==2.12.0 parso==0.8.3 pexpect==4.8.0 pickleshare==0.7.5 Pillow==9.4.0 platformdirs==2.6.2 pluggy==1.0.0 prompt-toolkit==3.0.36 protobuf==4.21.12 psutil==5.9.4 ptyprocess==0.7.0 pure-eval==0.2.2 pycodestyle==2.10.0 pycparser==2.21 pydocstyle==6.2.3 pyflakes==3.0.1 Pygments==2.14.0 pylint==2.15.10 pylint-codeclimate==1.2.4 pylint-exit==1.2.0 pymodes==2.14 PyNaCl==1.5.0 pyOpenSSL==23.0.0 pyparsing==3.0.9 pyproj==3.4.1 pyrsistent==0.19.3 pyshp==2.3.1 pytest==7.2.0 pytest-cov==4.0.0 python-dateutil==2.8.2 pytz==2022.7 PyYAML==6.0 pyzmq==24.0.1 requests==2.28.1 requests-pkcs12==1.14 rich==13.0.1 ruff==0.0.218 scikit-fuzzy==0.4.2 scipy==1.10.0 semantic-version==2.10.0 setuptools-scm==7.1.0 shapely==2.0.0 six==1.16.0 smmap==5.0.0 snakeviz==2.1.1 snowballstemmer==2.2.0 soupsieve==2.3.2.post1 Sphinx==5.3.0 sphinx-rtd-theme==1.1.1 sphinx_autodoc_typehints==1.20.1 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 sphinxcontrib.applehelp==1.0.3 stack-data==0.6.2 sympy==1.11.1 tomli==2.0.1 tomlkit==0.11.6 toolz==0.12.0 tornado==6.2 tqdm==4.64.1 traffic==2.8.1 traitlets==5.8.1 traittypes==0.2.1 types-pytz==2022.7.0.0 types-tqdm==4.64.7.9 typing_extensions==4.4.0 urllib3==1.26.13 wcwidth==0.2.5 webcolors==1.12 webcolors-stubs==0.0.3 widgetsnbextension==4.0.5 wrapt==1.14.1 xyzservices==2022.9.0 yapf==0.32.0 yarl==1.8.2