[Python-Dev] Re: Cycles in the __context__ chain

2020-06-15 Thread Chris Jerdonek
On Sun, Jun 14, 2020 at 9:19 AM Serhiy Storchaka wrote: > It is possible to create a loop by setting the __context__ attribute of > the raised exception, either explicitly, or implicitly, using "raise ... > from ...". I think we should separate the questions of what to do when (1) setting the c

[Python-Dev] Re: Cycles in the __context__ chain

2020-06-15 Thread Dennis Sweeney
Worth noting is that there is an existing loop-breaking mechanism, but only for the newest exception being raised. In particular, option (4) is actually the current behavior if the the most recent exception participates in a cycle: Python 3.9.0b1 >>> A, B, C, D, E = map(Exception, "ABCDE"