[issue39725] unrelated `from None` exceptions lose prior exception information

2020-03-15 Thread Ido Michael
Ido Michael added the comment: Can I take this change into a PR? Or is it still in the process? -- nosy: +Ido Michael ___ Python tracker ___ __

[issue39725] unrelated `from None` exceptions lose prior exception information

2020-02-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Because there may be more exceptions than the code writer know. The code raised OverflowError and ValueError may be in different function, so the code writer know only about ValueError, but OverflowError is an implementation detail (and may be absent in ot

[issue39725] unrelated `from None` exceptions lose prior exception information

2020-02-28 Thread Terry J. Reedy
Terry J. Reedy added the comment: Would it generaly work better if 'from None' only suppressed the previous exception? That is the only one that the code writer knows about. -- nosy: +terry.reedy ___ Python tracker

[issue39725] unrelated `from None` exceptions lose prior exception information

2020-02-23 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +17996 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18629 ___ Python tracker ___

[issue39725] unrelated `from None` exceptions lose prior exception information

2020-02-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It is more complicated. In the following example try: try: raise TypeError except: try: try: raise OverflowError except: raise ValueError except: raise KeyErr

[issue39725] unrelated `from None` exceptions lose prior exception information

2020-02-23 Thread Ethan Furman
Ethan Furman added the comment: Can this be fixed in the traceback module or is there C code behind it? -- ___ Python tracker ___ _

[issue39725] unrelated `from None` exceptions lose prior exception information

2020-02-23 Thread Ethan Furman
Ethan Furman added the comment: I think the way forward is going to be a recursive walk back to the first exception, and if __suppress_context__ is true for any exception then only the previous exception is omitted. For example, the above example had the following chain: Exception__cont

[issue39725] unrelated `from None` exceptions lose prior exception information

2020-02-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: For reference: PEP 3134 (and superseded PEP 344), PEP 409, PEP 415. -- ___ Python tracker ___ _

[issue39725] unrelated `from None` exceptions lose prior exception information

2020-02-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Interesting problem. Example which does not depend on os.environ: import traceback try: try: raise TypeError except: try: raise ValueError except: raise KeyError from None except BaseException as exc:

[issue39725] unrelated `from None` exceptions lose prior exception information

2020-02-22 Thread Ethan Furman
New submission from Ethan Furman : Using the example from https://bugs.python.org/msg293185: --- --> import os --> try: ... os.environ["NEW_VARIABLE"] = bug # bug is not a str ... finally: ... del os.environ["NEW_VARIA