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

not-an-iterable false positive on ExceptionGroup.exceptions #8985

Open
gszabo opened this issue Aug 30, 2023 · 0 comments
Open

not-an-iterable false positive on ExceptionGroup.exceptions #8985

gszabo opened this issue Aug 30, 2023 · 0 comments
Labels
Astroid Related to astroid Needs PR This issue is accepted, sufficiently specified and now needs an implementation python 3.11

Comments

@gszabo
Copy link

gszabo commented Aug 30, 2023

Bug description

hello.py

# pylint: disable=missing-module-docstring
eg = ExceptionGroup("Hello", [Exception("A"), Exception("B")])
for e in eg.exceptions:
    print(e)

Configuration

No response

Command used

pylint hello.py

Pylint output

************* Module hello
hello.py:3:9: E1133: Non-iterable value eg.exceptions is used in an iterating context (not-an-iterable)

Expected behavior

I would expect pylint to accept this code as correct. ExceptionGroup.exceptions is a tuple, which is an iterable type.

If I run the code with python hello.py, I get no errors and the messages of the two exception instances:

$ python hello.py
A
B

Pylint version

pylint 2.17.5
astroid 2.15.6
Python 3.11.4 (main, Jun 16 2023, 10:32:21) [GCC 11.3.0]

OS / Environment

Ubuntu 22.04

Additional dependencies

astroid==2.15.6
dill==0.3.7
isort==5.12.0
lazy-object-proxy==1.9.0
mccabe==0.7.0
platformdirs==3.10.0
pylint==2.17.5
tomlkit==0.12.1
wrapt==1.15.0
@gszabo gszabo added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Aug 30, 2023
@Pierre-Sassoulas Pierre-Sassoulas added Astroid Related to astroid python 3.12 Needs PR This issue is accepted, sufficiently specified and now needs an implementation and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Aug 30, 2023
@Pierre-Sassoulas Pierre-Sassoulas changed the title ExceptionGroup.exceptions is not-an-iterable not-an-iterable false positive on ExceptionGroup.exceptions Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Astroid Related to astroid Needs PR This issue is accepted, sufficiently specified and now needs an implementation python 3.11
Projects
None yet
Development

No branches or pull requests

3 participants