This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author iritkatriel
Recipients Dennis Sweeney, Rotem Yaari, Yury.Selivanov, chris.jerdonek, georg.brandl, iritkatriel, larsonreever, ncoghlan, python-dev, serhiy.storchaka, terry.reedy, yselivanov
Date 2021-08-08.16:52:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1628441565.88.0.227113641881.issue25782@roundup.psfhosted.org>
In-reply-to
Content
> > the result is  C -> A -> B -> C

> Did you mean C -> A -> B?

No, I meant C -> A -> B -> C -> A ....
the cycle remains unchanged.

> By the way, if you applied to this example your reasoning that  PyErr_SetObject shouldn't try to fix user bugs, should this example  instead be C -> A -> B -> C -> ... (leaving the cycle as is but just not hanging)? 

Yes, exactly, see above.

> Is it not being changed then because the reasoning doesn't apply, or because we're restricted in what we can do by backwards compatibility?

The reason for leaving the cycle unchanged is not backwards compatibility, it's that this function cannot break the cycle in a meaningful way (this is why it's hard to agree on how it should do that).

It can't be that A happened in the context of B at the same time that B happened in the context of A. So a cycle means there was a bug somewhere, and the exception's history is corrupt, so changing it will only make it more corrupt and harder to debug.

Note that PyErr_SetObject avoids creating cycles, so the cycle was not created by someone catching an exception e and doing "raise e". It was caused by some other code tampering with the __context__ in an incorrect way.
History
Date User Action Args
2021-08-08 16:52:45iritkatrielsetrecipients: + iritkatriel, georg.brandl, terry.reedy, ncoghlan, chris.jerdonek, Yury.Selivanov, python-dev, serhiy.storchaka, yselivanov, Rotem Yaari, larsonreever, Dennis Sweeney
2021-08-08 16:52:45iritkatrielsetmessageid: <1628441565.88.0.227113641881.issue25782@roundup.psfhosted.org>
2021-08-08 16:52:45iritkatriellinkissue25782 messages
2021-08-08 16:52:45iritkatrielcreate