Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

TypeError whenexcept* catches an unhashable exception #99181

Closed
Assignees
iritkatriel
Labels
3.11only security fixes3.12only security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error
@Zac-HD

Description

@Zac-HD

I recently hadpytest-dev/pytest#10466 reported, and it seems likely to be an upstream bug inexcept* - cc@iritkatriel fyi.
A somewhat simplified reproducing example:

classMyException(Exception):__hash__=None# Traditional try-except works fine with unhashable exceptions, e.g.:try:raiseExceptionGroup("Foo", [MyException("Bar")])exceptException:pass# But here we'll get a TypeError:try:raiseExceptionGroup("Foo", [MyException("Bar")])except*Exception:pass
  + Exception Group Traceback (most recent call last):  |   File "repro.py", line 12, in <module>  |     raise ExceptionGroup("Foo", [MyException("Bar")])  | ExceptionGroup: Foo (1 sub-exception)  +-+---------------- 1 ----------------| MyException: Bar+------------------------------------During handling of the above exception, another exception occurred:Traceback (most recent call last):  File "repro.py", line -1, in <module>TypeError:unhashable type: 'MyException'

If this is the intended behavior of course we'll work around it in Pytest, but we decided to report upstream in case it's not 🙂

Metadata

Metadata

Assignees

Labels

3.11only security fixes3.12only security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp