Skip to content

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

@gszabo

Description

@gszabo

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 

Metadata

Metadata

Assignees

Labels

AstroidRelated to astroidNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationpython 3.11

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions