New submission from Oleg Iarygin <o...@arhadthedev.net>:

Currently, exception chaining in Lib/ modules is implemented with pre-3.11 
`raise Foo(...).with_traceback(sys.exc_info()[2])`. However, this approach can 
be simplified:

1. PEP 3134 introduced a proper `raise Foo(...) from bar` construction that 
takes a parent exception instead of its stack traceback

2. Without the traceback required, we partially get rid of `sys.exc_info` thus 
reducing active tapping into global internals

A report printed into a console remains the same except a line:

> During handling of the above exception, another exception occurred

replaced with:

> The above exception was the direct cause of the following exception

----------
components: Library (Lib)
messages: 415864
nosy: arhadthedev
priority: normal
severity: normal
status: open
title: Replace with_traceback() with exception chaining and reraising
type: enhancement
versions: Python 3.11

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue47099>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to