Closed marksmayo closed 1 year ago
I was able to reproduce by copying webpy utils.py and running latest pytest
on it.
Thank you for the investigation @clavedeluna
The issue is happening because this code:
def safeiter(it, cleanup=None, ignore_errors=True):
"""Makes an iterator safe by ignoring the exceptions occurred during the iteration."""
def next():
while True:
try:
return next(it)
except StopIteration:
raise
except Exception:
traceback.print_exc()
it = iter(it)
while True:
yield next()
is defining a function called next
, which shadows the builtin next
. If we rename it to custom_next
the issue goes away. Of course this is only a hack-solution; pylint should be able to handle this unfortunate naming.
I'll take a closer look at _check_raising_stopiteration_in_generator_next_call
which handles next
via inference, but perhaps we need to be more specific!
Bug description
When parsing the following file:
pylint crashed with a
AstroidError
and with the following stacktrace:Configuration
No response
Command used
Pylint output
Expected behavior
to parse currently and show pylint issues
Pylint version
OS / Environment
Windows 11
Additional dependencies
WARNING: Ignoring invalid distribution -ypy (c:\python310\lib\site-packages) WARNING: Ignoring invalid distribution -umpy (c:\python310\lib\site-packages) WARNING: Ignoring invalid distribution -ip (c:\python310\lib\site-packages) WARNING: Ignoring invalid distribution -aker (c:\python310\lib\site-packages) abodepy==1.2.2 absl-py==1.2.0 aenum==3.1.11 aioambient==2021.12.0 aioaseko==0.0.2 aiocoap==0.4.4 aiohttp==3.8.1 aiosignal==1.2.0 ambee==0.4.0 anthemav==1.4.2 anyio==3.6.1 appdirs==1.4.4 Appium-Python-Client==2.6.0 arcam-fmj==0.12.0 astral==2.2 astroid==2.12.10 asttokens==2.0.8 astunparse==1.6.3 async-generator==1.10 async-timeout==4.0.2 async-upnp-client==0.31.2 asyncio==3.4.3 atomicwrites==1.4.1 atomicwrites-homeassistant==1.4.1 attrs==21.2.0 auditwheel==5.1.2 autobahn==22.7.1 autofaker==0.4.9 Automat==20.2.0 autopage==0.5.1 autopep8==1.7.0 awesomeversion==22.8.0 axe-selenium-python==2.1.6 axis==44 azure-cognitiveservices-vision-computervision==0.9.0 azure-common==1.1.28 azure-core==1.25.1 azure-eventhub==5.10.1 azure-functions==1.11.2 backcall==0.2.0 bandit==1.7.4 bcrypt==3.1.7 beautifulsoup4==4.11.1 bidict==0.22.0 bitarray==2.6.0 black==22.8.0 bleach==5.0.1 bleak==0.16.0 bleak-winrt==1.2.0 blebox-uniapi==2.1.0 blinker==1.5 bluetooth-auto-recovery==0.3.3 botocore==1.27.89 Brotli==1.0.9 bs4==0.0.1 btsocket==0.2.0 CacheControl==0.12.11 cachetools==5.2.0 cachy==0.3.0 certifi==2022.6.15 cffi==1.15.1 cfgv==3.3.1 chacha20poly1305-reuseable==0.0.4 charset-normalizer==2.1.0 cheroot==8.6.0 chromedriver==2.24.1 chromedriver-autoinstaller==0.3.1 ciso8601==2.2.0 classes==0.4.1 cleo==1.0.0a5 cli-ui==0.17.2 click==8.1.3 click-default-group==1.2.2 cliff==4.0.0 cmd2==2.4.2 codespell==2.1.0 colorama==0.4.5 colored==1.4.3 colorlog==6.7.0 commentjson==0.9.0 commonmark==0.9.1 ConfigArgParse==1.5.3 constantly==15.1.0 contextlib2==21.6.0 contributors-txt==0.9.2 coverage==6.4.4 coveralls==3.3.1 crashtest==0.3.1 cryptography==37.0.4 cssselect==1.1.0 cycler==0.11.0 dacite==1.6.0 datadog==0.44.0 debugpy==1.6.3 decorator==5.1.1 deepface==0.0.75 defusedxml==0.7.1 delayed-assert==0.3.6 Deprecated==1.2.13 dill==0.3.5.1 distlib==0.3.6 distro==1.7.0 docopt==0.6.2 docutils==0.19 dodgy==0.2.1 dulwich==0.20.46 entrypoints==0.4 exceptiongroup==1.0.0rc9 execnet==1.9.0 executing==1.0.0 extras==1.0.0 fake-factory==9999.9.9 Faker==15.0.0 filelock==3.8.0 fire==0.4.0 fivem==1.1 fixtures==4.0.1 flake8==5.0.4 flake8-polyfill==1.0.2 flake8-typing-imports==1.13.0 flaky==3.7.0 Flask==2.2.2 flatbuffers==2.0.7 fnvhash==0.1.0 fonttools==4.37.1 freezegun==1.2.2 frozenlist==1.3.1 future==0.18.2 gast==0.4.0 gdown==4.5.1 gitdb==4.0.9 GitPython==3.1.27 goalzero==0.2.1 goodwe==0.2.20 google-api-core==2.10.1 google-api-python-client==2.62.0 google-auth==2.11.0 google-auth-httplib2==0.1.0 google-auth-oauthlib==0.5.3 google-pasta==0.2.0 googleapis-common-protos==1.56.4 gprof2dot==2022.7.29 graphviz==0.20.1 greenlet==1.1.2 grpcio==1.48.1 h11==0.12.0 h2==4.1.0 h5py==3.7.0 hacklib==0.1.5 hangups==0.4.18 herepy==3.5.8 home-assistant-bluetooth==1.3.0 homeassistant==2022.9.2 hpack==4.0.0 html5lib==1.1 httpcore==0.15.0 httplib2==0.20.4 httpx==0.23.0 hyperframe==6.0.1 hyperlink==21.0.0 hypothesis==6.56.0 identify==2.5.5 idna==3.3 ifaddr==0.1.7 importlib-metadata==4.12.0 incremental==21.3.0 iniconfig==1.1.1 invoke==1.7.3 ipykernel==6.15.2 ipython==8.5.0 iso8601==1.0.2 isodate==0.6.1 isort==5.10.1 itemadapter==0.7.0 itemloaders==1.0.6 itsdangerous==2.1.2 jaraco.classes==3.2.2 jaraco.functools==3.5.2 jedi==0.18.1 Jinja2==3.1.2 jmespath==1.0.1 joblib==1.1.0 jsonschema==4.16.0 jupyter-core==4.11.1 jupyter_client==7.3.5 jwt==1.3.1 kaitaistruct==0.10 keras==2.10.0 Keras-Preprocessing==1.1.2 keyring==23.9.1 kiwisolver==1.4.4 lark-parser==0.7.8 lazy-object-proxy==1.7.1 libclang==14.0.6 libsass==0.21.0 lockfile==0.12.2 lomond==0.3.3 lru-dict==1.1.8 lupupy==0.1.9 lxml==4.9.1 Markdown==3.4.1 MarkupSafe==2.1.1 matplotlib==3.5.3 matplotlib-inline==0.1.6 mccabe==0.7.0 MechanicalSoup==0.12.0 mechanize==0.4.8 mediafile==0.9.0 miniaudio==1.52 mock-open==1.4.0 more-itertools==8.14.0 MouseInfo==0.1.3 msgpack==1.0.4 msrest==0.7.1 mtcnn==0.1.1 multidict==6.0.2 mutagen==1.45.1 mypy==0.981 mypy-extensions==0.4.3 nest-asyncio==1.5.5 nexia==2.0.2 nextcord==2.2.0 nodeenv==1.7.0 numpy==1.23.3 oauthlib==3.2.1 objgraph==3.5.0 opencv-python==4.6.0.66 opt-einsum==3.3.0 orjson==3.7.11 outcome==1.2.0 packaging==21.3 paho-mqtt==1.6.1 pandas==1.4.4 parsel==1.6.0 parso==0.8.3 pathspec==0.10.1 pbr==5.9.0 pep517==0.13.0 pep8==1.7.1 pep8-naming==0.10.0 pexpect==4.8.0 pickleshare==0.7.5 Pillow==9.2.0 pipreqs==0.4.11 pixelmatch==0.3.0 pkginfo==1.8.3 platformdirs==2.5.2 playwright==1.25.2 pluggy==1.0.0 ply==3.11 poetry==1.2.0 poetry-core==1.1.0 poetry-plugin-export==1.0.6 pre-commit==2.20.0 prettytable==3.4.1 prompt-toolkit==3.0.31 prospector==1.7.7 Protego==0.2.1 psutil==5.9.2 ptyprocess==0.7.0 pure-eval==0.2.2 py==1.11.0 py-cpuinfo==8.0.0 pyairvisual==2022.7.0 pyasn1==0.4.8 pyasn1-modules==0.2.8 pyatag==0.3.5.3 pyatmo==7.0.1 pyatv==0.10.3 PyAutoGUI==0.9.53 pybalboa==0.13 pycodestyle==2.9.1 pycparser==2.21 pycryptodomex==3.15.0 pydantic==1.10.2 pydeconz==104 PyDispatcher==2.0.6 pydivert==2.1.0 pydocstyle==6.1.1 pyee==8.1.0 pyelftools==0.29 pyenchant==3.2.2 pyfiglet==0.8.post1 pyfritzhome==0.6.7 pyftpdlib==1.5.7 pyfttt==0.3.2 PyGetWindow==0.0.9 PyGithub==1.55 Pygments==2.13.0 pygtfs==0.1.7 pygtrie==2.5.0 PyJWT==2.4.0 pylama==8.3.8 pyleniumio==1.16.1 pylev==1.4.0 pylint==2.15.3 pylint-celery==0.3 pylint-django==2.5.3 pylint-flask==0.6 pylint-plugin-utils==0.7 pylint-runner==0.6.0 PyMsgBox==1.0.9 PyNaCl==1.5.0 pyOpenSSL==22.0.0 pyotp==2.7.0 pyparsing==3.0.9 pyperclip==1.8.2 pyreadline3==3.4.1 PyRect==0.2.0 PyRIC==0.1.6.3 pyrsistent==0.18.1 PyScreeze==0.1.28 pyserial==3.5 pysmb==1.2.8 pysnmp-pyasn1==1.1.2 pysnmp-pysmi==1.1.10 PySocks==1.7.1 pytest==7.1.3 pytest-asyncio==0.19.0 pytest-base-url==2.0.0 pytest-benchmark==3.4.1 pytest-cov==3.0.0 pytest-forked==1.4.0 pytest-mpi==0.6 pytest-parallel==0.1.1 pytest-playwright==0.3.0 pytest-profiling==1.7.0 pytest-repeat==0.9.1 pytest-reportportal==5.1.2 pytest-socket==0.5.1 pytest-timeout==2.1.0 pytest-xdist==2.5.0 python-awair==0.2.4 python-dateutil==2.8.2 python-didl-lite==1.3.2 python-dotenv==0.21.0 python-engineio==4.3.4 python-nmap==0.7.1 python-slugify==4.0.1 python-socketio==5.7.1 python-subunit==1.4.0 pytweening==1.0.4 pytz==2022.2.1 pyupgrade==2.37.3 pywin32==304 pywin32-ctypes==0.2.0 PyYAML==6.0 pyzmq==23.2.1 qualname==0.1.0 queuelib==1.6.2 random2==1.0.1 re-wx==0.0.10 readlike==0.1.3 readme-renderer==37.2 redbird==0.5.1 refurb==1.1.0 rellu==0.7 ReParser==1.4.3 reportportal-client==5.2.3 requests==2.28.1 requests-file==1.5.1 requests-mock==1.10.0 requests-oauthlib==1.3.1 requests-toolbelt==0.9.1 requirements-detector==0.7 resources==0.0.1 retina-face==0.0.12 rfc3986==2.0.0 rich==12.5.1 rich-click==1.5.2 robot==20071211 robotframework==5.0.1 rsa==4.9 rstr==3.2.0 schema==0.7.5 schiene==0.24 scikit-learn==1.1.2 scipy==1.9.1 Scrapy @ file:///C:/Users/markm/GitHub/scrapy selenium==4.1.0 selenium-wire==4.6.5 serial==0.0.97 service-identity==21.1.0 setoptconf-tmp==0.3.1 shellingham==1.5.0 six==1.16.0 sklearn==0.0 slugify==0.0.1 smmap==5.0.0 sniffio==1.2.0 snowballstemmer==2.2.0 somecomfort==0.8.0 sortedcontainers==2.4.0 soupsieve==2.3.2.post1 SQLAlchemy==1.4.41 srptools==1.0.1 stack-data==0.5.0 staty==1.2.4 stdlib-list==0.7.0 stestr==4.0.1 stevedore==3.5.0 stringcase==1.2.0 sybil==3.0.1 tabulate==0.8.10 tblib==1.7.0 tbump==6.9.0 tensorboard==2.10.0 tensorboard-data-server==0.6.1 tensorboard-plugin-wit==1.8.1 tensorflow==2.10.0 tensorflow-estimator==2.10.0 tensorflow-io-gcs-filesystem==0.27.0 termcolor==2.0.1 testfixtures==7.0.0 testscenarios==0.5.0 testtools==2.5.0 text-unidecode==1.3 threadpoolctl==3.1.0 tldextract==3.4.0 tokenize-rt==4.2.1 toml==0.10.2 tomli==2.0.1 tomlkit==0.11.4 tornado==6.2 towncrier==22.8.0 tox==3.26.0 tqdm==4.64.1 traitlets==5.4.0 trio==0.21.0 trio-websocket==0.9.2 twine==4.0.1 Twisted==22.4.0 twisted-iocpsupport==1.0.2 txaio==22.2.1 typed-ast==1.5.4 types-atomicwrites==1.4.1 types-backports==0.1.3 types-certifi==0.1.4 types-chardet==0.1.5 types-croniter==1.0.0 types-cryptography==3.3.23 types-decorator==0.1.7 types-enum34==0.1.8 types-ipaddress==0.1.5 types-pkg-resources==0.1.3 types-pyOpenSSL==22.0.10 types-python-slugify==0.1.2 types-pytz==2021.1.2 types-PyYAML==5.4.6 types-requests==2.28.7 types-toml==0.1.5 types-ujson==0.1.1 types-urllib3==1.26.20 typing-inspect==0.8.0 typing_extensions==4.4.0 uamqp==1.6.0 Unidecode==1.3.4 uritemplate==4.1.1 urllib3==1.26.12 urwid==2.1.2 urwid-readline==0.13 validators==0.20.0 virtualenv==20.16.5 voluptuous==0.13.1 voluptuous-serialize==2.5.0 w3lib==2.0.1 waitress==2.1.2 wc==1.0.1 wcwidth==0.2.5 webdriver-manager==3.8.3 webencodings==0.5.1 websockets==10.3 Werkzeug==2.2.2 windows-curses==2.3.0 wrapt==1.14.1 wsproto==1.1.0 wxPython==4.2.0 xmltodict==0.13.0 yamllint==1.27.1 yarg==0.1.9 yarl==1.7.2 zeroconf==0.39.1 zipp==3.8.1 zope.interface==5.4.0 zstandard==0.18.0