Opened 6 years ago

Closed 5 years ago

Last modified 4 years ago

#29393 closed Bug (fixed)

Infinite loop in ExceptionReporter.get_traceback_frames()

Reported by: James Howe Owned by: Tim Graham <timograham@…>
Component: Error reporting Version: 2.0
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The following code generates a cause/context cycle (exc_value.__cause__.__context__ is exc_value):

except WrapperException as exc:
    raise exc.__cause__

The while exc_value loop then never terminates.

Change History (7)

comment:1 by James Howe, 6 years ago

A possible workaround would be available if PEP 415 (__suppress_context__) were respected.

comment:2 by Tim Graham, 6 years ago

Can you please give code to reproduce the issue?

comment:3 by James Howe, 6 years ago

In a view, with DEBUG = True.

try:
    raise RuntimeError('outer') from RuntimeError('inner')
except RuntimeError as exc:
    raise exc.__cause__

comment:4 by Tim Graham, 6 years ago

Summary: Infinite loop in ExceptionReporter.get_traceback_framesInfinite loop in ExceptionReporter.get_traceback_frames()
Triage Stage: UnreviewedAccepted

comment:5 by Tim Graham, 5 years ago

Has patch: set

comment:6 by Tim Graham <timograham@…>, 5 years ago

Owner: set to Tim Graham <timograham@…>
Resolution: fixed
Status: newclosed

In 3634560f:

Fixed #29393 -- Prevented infinite loop in ExceptionReporter.get_traceback_frames().

comment:7 by Chris Jerdonek, 4 years ago

I filed #31675, which is an enhancement related to this issue.

Note: See TracTickets for help on using tickets.
Back to Top