This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients brett.cannon, martin.panter, mbussonn, terry.reedy
Date 2017-02-27.07:31:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1488180696.37.0.173765173015.issue26389@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-02-27 07:31:36martin.pantersetrecipients: + martin.panter, brett.cannon, terry.reedy, mbussonn
2017-02-27 07:31:36martin.pantersetmessageid: <1488180696.37.0.173765173015.issue26389@psf.upfronthosting.co.za>
2017-02-27 07:31:36martin.panterlinkissue26389 messages
2017-02-27 07:31:35martin.pantercreate