[issue15209] Re-raising exceptions from an expression
Ethan Furman
report at bugs.python.org
Thu Jun 28 00:20:12 CEST 2012
Ethan Furman <ethan at stoneleaf.us> added the comment:
Patch attached. It basically says:
8<--------------------------------------------------------------------
Note: Because using :keyword:`from` can throw away valuable debugging information, its use with a bare :keyword:`raise` is not supported. If you are trying to do this:
try:
some_module.not_here()
except NameError:
try:
backup_module.not_here()
except NameError:
raise from None # suppress context in NameError
do this instead:
try:
some_module.not_here()
except NameError:
try:
backup_module.not_here()
except NameError as exc:
raise exc from None # suppress context in NameError
8<--------------------------------------------------------------------
----------
keywords: +patch
Added file: http://bugs.python.org/file26191/raise_from_doc_update.diff
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15209>
_______________________________________
More information about the Python-bugs-list
mailing list