Skip to content

NameError: name 'ExceptionGroup' is not defined #4563

Closed

Description

@torarvid

Feature

This test file:

eg: ExceptionGroup = ExceptionGroup("test", [Exception("test1"), Exception("test2")])
print(eg)

yields the following in CPython 3.11.1:

❯ python test.py 
test (2 sub-exceptions)

and this error in RustPython v0.2.0

❯ rustpython test.py 
Traceback (most recent call last):
  File "test.py", line 1, in <module>
    eg: ExceptionGroup = ExceptionGroup("test", [Exception("test1"), Exception("test2")])
NameError: name 'ExceptionGroup' is not defined

I discovered this when using ruff. I first created this ruff issue but now I believe this repo is where the issue might belong 🙂

Python Documentation

ExceptionGroup is now a Python builtin (new in 3.11)

https://docs.python.org/3/library/exceptions.html#exception-groups

Activity

  1. DimitrisJim commented on Feb 24, 2023

    @DimitrisJim
    Member

    this repo is where the issue might belong

    It definitely is, thanks for reporting! We just recently bumped to using 3.11 so some things aren't here yet. Adding these shouldn't be too difficult though, just adding the names alone (for now) would fix this issue.

  2. arihant2math commented on Apr 23, 2025

    @arihant2math
    Contributor

    Exception groups have been added now.

  3. youknowone commented on Apr 23, 2025

    @youknowone
    Member

    #5254 added it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-vmArea: virtual machine

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions