PythonPython오류 코드
BaseExceptionGroup
BaseExceptionGroup
어떤 문제인가요?
여러 BaseException을 묶어 보고한 예외 그룹입니다.
공식 설명 · 원문
Both of these exception types wrap the exceptions in the sequence excs. The msg parameter must be a string. The difference between the two classes is that BaseExceptionGroup extends BaseException and it can wrap any exception, while ExceptionGroup extends Exception and it can only wrap subclasses of Exception. This design is so that except Exception catches an ExceptionGroup but not BaseExceptionGroup.
The BaseExceptionGroup constructor returns an ExceptionGroup rather than a BaseExceptionGroup if all contained exceptions are Exception instances, so it can be used to make the selection automatic. The ExceptionGroup constructor, on the other hand, raises a TypeError if any contained exception is not an Exception subclass.
Exception groups are generic over the type of their contained exceptions.
Note that BaseExceptionGroup defines __new__(), so subclasses that need a different constructor signature need to override that rather than __init__(). For example, the following defines an exception group subclass which accepts an exit_code and constructs the group’s message from it.
Like ExceptionGroup, any subclass of BaseExceptionGroup which is also a subclass of Exception can only wrap instances of Exception.
해결·진단 링크
문서의 제품·버전·발생 환경이 현재 상황과 일치하는지 먼저 확인하세요.
- 코드 참고
공식 예외·경고 설명 ↗
정의·설명 · 해결 절차 아님
- 일반 진단 가이드
예외 추적 읽기와 처리 방법 ↗
제품 전반 · 해당 코드 전용 아님
출처·이용 조건
Built-in Exceptions — Python 3.15.2 documentation ↗
저작자: Python Software Foundation
라이선스: Python Software Foundation License Version 2
확인일: 2026-11-12
변경 내역: English prose extracted; whitespace normalized; Korean context and classified official links added. Python code examples not redistributed.