**Bug Report** If we use Union of exception types inside Tuple as a variable in an except clause, mypy produces a false-positive error. Relates to #2816 **To Reproduce** ```python def handle(err: tuple[type[ValueError] | type[TypeError], ...]): try: return None except err: # error pass ``` Gist URL: https://gist.github.com/mypy-play/dd08b2806979cb4b7228e7565046f675 Playground URL: https://mypy-play.net/?mypy=latest&python=3.12&flags=strict&gist=dd08b2806979cb4b7228e7565046f675 **Expected Behavior** No error. **Actual Behavior** ``` main.py:4: error: Exception type must be derived from BaseException (or be a tuple of exception classes) [misc] ``` **Your Environment** - Mypy version used: 1.11.2 - Mypy command-line flags: - - Mypy configuration options from `mypy.ini` (and other config files): - - Python version used: 3.12
Bug Report
If we use Union of exception types inside Tuple as a variable in an except clause, mypy produces a false-positive error.
Relates to #2816
To Reproduce
Gist URL: https://gist.github.com/mypy-play/dd08b2806979cb4b7228e7565046f675
Playground URL: https://mypy-play.net/?mypy=latest&python=3.12&flags=strict&gist=dd08b2806979cb4b7228e7565046f675
Expected Behavior
No error.
Actual Behavior
Your Environment
mypy.ini(and other config files): -