On Mon, 18 Sep 2017 20:35:02 +1000 Nick Coghlan <ncoghlan@gmail.com> wrote:
On 18 September 2017 at 20:18, Victor Stinner <victor.stinner@gmail.com> wrote:
2017-09-18 12:07 GMT+02:00 Nick Coghlan <ncoghlan@gmail.com>:
I wonder if it might be reasonable to have tracebacks only hold a weak reference to their frame objects when "__debug__ == False".
Please don't change the Python behaviour depending on __debug__, or it will be a nightmare to debug it :-( ("Why does it work on my computer?")
Yeah, that's always a challenge :)
Rather than being thread local or context local state, whether or not to keep the full frames in the traceback could be a yet another setting on the *exception* object, whereby we tweaked the logic that drops the reference at the end of an except clause as follows:
That doesn't solve the problem, since the issue is that exceptions can be raised (and then silenced) in many places, and you don't want such exception-raising code (such as socket.create_connection) to start having to set an option on the exceptions it raises. Regards Antoine.