[issue39228] traceback.FrameSummary does not handle exceptions from `repr()`

2021-11-07 Thread Martin
Martin added the comment: I submitted a pull request for the related issue43656: https://github.com/python/cpython/pull/29299 It introduces a format_locals parameter that enables the customized formatting of a FrameSummary. This way, a user of traceback could provide a function that handles

[issue39228] traceback.FrameSummary does not handle exceptions from `repr()`

2021-05-12 Thread Irit Katriel
Change by Irit Katriel : -- resolution: -> not a bug stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue39228] traceback.FrameSummary does not handle exceptions from `repr()`

2021-05-09 Thread Terry J. Reedy
Change by Terry J. Reedy : -- nosy: -terry.reedy versions: +Python 3.11 -Python 3.7, Python 3.8, Python 3.9 ___ Python tracker ___

[issue39228] traceback.FrameSummary does not handle exceptions from `repr()`

2021-05-08 Thread Andrei Kulakov
Andrei Kulakov added the comment: This probably shouldn't be done, for all of the reasons above. For the sake of an argument, if we really wanted to do something like this (as it may be convenient in some cases), a better way might be to add a `__tb_repr__ = __repr__` which can be overridden

[issue39228] traceback.FrameSummary does not handle exceptions from `repr()`

2021-05-07 Thread Irit Katriel
Irit Katriel added the comment: I think pdb is a different story because it's an interactive application rather than a library. pdb can decide that it prints an error to the screen and returns to the interactive prompt, if that is appropriate. The functions of the traceback module don't have

[issue39228] traceback.FrameSummary does not handle exceptions from `repr()`

2021-03-31 Thread Martin
Martin added the comment: pdb uses vanilla repr as well: https://github.com/python/cpython/blob/f3ab670fea75ebe177e3412a5ebe39263cd428e3/Lib/pdb.py#L1180 -- ___ Python tracker __

[issue39228] traceback.FrameSummary does not handle exceptions from `repr()`

2021-03-31 Thread Martin
Martin added the comment: > Even correctly raised code can raise exceptions such as MemoryError, > RecursionError and KeybordInterrupt. For me, this is an argument in favor of the change (although KeybordInterrupt and probably a couple more should not be caught). traceback is used in contex

[issue39228] traceback.FrameSummary does not handle exceptions from `repr()`

2021-03-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See also issue43656. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue39228] traceback.FrameSummary does not handle exceptions from `repr()`

2021-03-30 Thread Irit Katriel
Irit Katriel added the comment: If we decide to reject this then we should add unit tests that show this state of affairs is deliberate. -- nosy: +iritkatriel ___ Python tracker

[issue39228] traceback.FrameSummary does not handle exceptions from `repr()`

2021-03-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: __repr__() and repr() can raise exceptions. Silencing arbitrary exception is usually a bad idea. Even correctly raised code can raise exceptions such as MemoryError, RecursionError and KeybordInterrupt. For this reason I think that the proposed change shou

[issue39228] traceback.FrameSummary does not handle exceptions from `repr()`

2021-03-30 Thread Martin
Martin added the comment: > As is true for most special methods, it is a bug for __repr__ methods to > raise. Is this codified anywhere? I only learned about that in this bug report. -- nosy: +moi90 ___ Python tracker

[issue39228] traceback.FrameSummary does not handle exceptions from `repr()`

2020-01-10 Thread Terry J. Reedy
Terry J. Reedy added the comment: As is true for most special methods, it is a bug for __repr__ methods to raise. They should return a string, as documented. Special method wrappers generally assume that the wrapped methods work. In particular, repr assumes this, and so do the __repr__ met

[issue39228] traceback.FrameSummary does not handle exceptions from `repr()`

2020-01-05 Thread daniel hahler
Change by daniel hahler : -- keywords: +patch pull_requests: +17276 stage: -> patch review pull_request: https://github.com/python/cpython/pull/17855 ___ Python tracker ___ __

[issue39228] traceback.FrameSummary does not handle exceptions from `repr()`

2020-01-05 Thread daniel hahler
New submission from daniel hahler : Exceptions within `__repr__` methods of captured locals (e.g. via the `capture_locals` argument of `TracebackException`) are not handled: ``` import traceback class CrashingRepr: def __repr__(self): raise RuntimeError("crash") traceback.FrameS