[New-bugs-announce] [issue30792] Add contextlib.convert_exception manager
Steven D'Aprano
report at bugs.python.org
Wed Jun 28 11:48:31 EDT 2017
New submission from Steven D'Aprano:
As discussed on Python-Ideas, there's some interest in a context manager that can convert an exception from one type to another (similarly to the way PEP 479 has StopIteration converted to RuntimeError.
See the thread starting here:
https://mail.python.org/pipermail/python-ideas/2017-June/046109.html
and particularly Nick's comment here:
https://mail.python.org/pipermail/python-ideas/2017-June/046218.html
I've written a recipe on ActiveState:
https://code.activestate.com/recipes/580808-guard-against-an-exception-in-the-wrong-place/
which acts as both a context manager and function decorator. That can be used as proof-of-concept or as a basis for a PR.
----------
components: Library (Lib)
messages: 297193
nosy: ncoghlan, steven.daprano
priority: normal
severity: normal
status: open
title: Add contextlib.convert_exception manager
type: enhancement
versions: Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30792>
_______________________________________
More information about the New-bugs-announce
mailing list