Message288621
Matthias’s proposal adds support for a new keyword-only “exc” argument:
print_exception(exc=exception_instance)
I still think it is worth supporting a single positional argument as well:
print_exception(exception_instance)
Another point is that it may be better to keep the existing parameter name “value”, rather than (eventually?) replacing it with “exc”. I think both of these things could be accomplished by juggling the “value” and “etype” parameters:
def print_exception(etype=None, value=None, tb=None, ...):
if value is None: # Assume value passed as first positional argument
value = etype
etype = None
if etype is tb is None: # Only value passed
etype = type(value)
tb = value.__traceback__
# Existing code using (etype, value, tb)
The disadvantage of any of these changes is that we may want to maintain support for the old signature while Python 2 remains alive. |
|
Date |
User |
Action |
Args |
2017-02-27 07:31:36 | martin.panter | set | recipients:
+ martin.panter, brett.cannon, terry.reedy, mbussonn |
2017-02-27 07:31:36 | martin.panter | set | messageid: <1488180696.37.0.173765173015.issue26389@psf.upfronthosting.co.za> |
2017-02-27 07:31:36 | martin.panter | link | issue26389 messages |
2017-02-27 07:31:35 | martin.panter | create | |
|