[New-bugs-announce] [issue46332] Use raise..from in logging/config instead of assigning __cause__
Irit Katriel
report at bugs.python.org
Mon Jan 10 09:21:23 EST 2022
New submission from Irit Katriel <iritkatriel at gmail.com>:
Lib/logging/config.py has this, which looks like it's partly remnants of old exception handling APIs:
except ImportError:
e, tb = sys.exc_info()[1:]
v.__cause__, v.__traceback__ = e, tb
raise v
It is clearer if written as:
except ImportError as e:
v = ValueError('Cannot resolve %r: %s' % (s, e))
raise v from e
(note that this doesn't copy the traceback from e to v, but this is redundant information anyway because e is chained to v as the cause).
----------
components: Library (Lib)
messages: 410218
nosy: iritkatriel
priority: normal
severity: normal
status: open
title: Use raise..from in logging/config instead of assigning __cause__
versions: Python 3.11
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46332>
_______________________________________
More information about the New-bugs-announce
mailing list