File tree Expand file tree Collapse file tree 1 file changed +1
-12
lines changed
Expand file tree Collapse file tree 1 file changed +1
-12
lines changed Original file line number Diff line number Diff line change @@ -343,16 +343,6 @@ def test_exceptiongroup_starlette_collapse():
343343 )
344344 except ExceptionGroup as exc :
345345 exception_group = exc
346-
347- # Simulate Starlette's collapse_excgroups() as seen here:
348- # https://github.com/Kludex/starlette/blob/0e88e92b592bfa11fd92e331869a8d49ba34b541/starlette/_utils.py#L79-L87
349- #
350- # When an ExceptionGroup contains a single exception, collapse_excgroups
351- # unwraps it and re-raises the inner exception. This causes Python to
352- # implicitly set unwrapped.__context__ = ExceptionGroup (because the
353- # re-raise happens inside the except block handling the ExceptionGroup),
354- # creating a cycle:
355- # exception_group -> .exceptions[0] -> ValueError -> __context__ -> exception_group
356346 unwrapped = exc .exceptions [0 ]
357347 try :
358348 raise unwrapped
@@ -422,8 +412,7 @@ def test_cyclic_exception_group_cause():
422412 Test case related to `test_exceptiongroup_starlette_collapse` above. We want to make sure that
423413 the same cyclic loop cannot happen via the __cause__ as well as the __context__
424414 """
425- # Construct the exact cyclic structure that anyio/Starlette creates when
426- # an exception propagates through multiple BaseHTTPMiddleware layers.
415+
427416 original = ValueError ("original error" )
428417 group = ExceptionGroup ("unhandled errors in a TaskGroup" , [original ])
429418 original .__cause__ = group
You can’t perform that action at this time.
0 commit comments