[issue47099] Replace with_traceback() with exception chaining and reraising

2022-03-30 Thread Oleg Iarygin


Change by Oleg Iarygin :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue47099] Replace with_traceback() with exception chaining and reraising

2022-03-23 Thread Irit Katriel


Irit Katriel  added the comment:

You don't need sys.exc_info() for the traceback anymore.

except Exception as e:
raise OSError('blah').with_traceback(e.__traceback__)

--
nosy: +iritkatriel

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue47099] Replace with_traceback() with exception chaining and reraising

2022-03-23 Thread Oleg Iarygin


Change by Oleg Iarygin :


--
keywords: +patch
pull_requests: +30162
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/32074

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue47099] Replace with_traceback() with exception chaining and reraising

2022-03-23 Thread Oleg Iarygin


New submission from Oleg Iarygin :

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com