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 mbussonn
Recipients brett.cannon, martin.panter, mbussonn, terry.reedy
Date 2017-03-03.05:29:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1488519000.39.0.726327261789.issue26389@psf.upfronthosting.co.za>
In-reply-to
Content
> (Optional) Change 'value' to 'exc' in the API to reflect the 3.x restriction Keep the synonym until after 2.7. 

Do you mean after 2.7 EOL, or after 3.7 ?


> etype: In 3.5+ document that it is an ignored dummy argument and that one can just pass 0, '', or None.
> (Optional) Deprecate the parameter and make it optional.  This can be handled* in the code and would be like range having option 'start'.  This is messy but would be temporary.  

That seem hard to do if we want to allow func(exception), should we attempt to emit a deprecation warning only when etype is used in the Legacy Form ?

> Remove after 2.7.

Same question as above, unsure what you mean. 


> (Optional) Change 'value' to 'exc' in the API to reflect the 3.x restriction. Document 'value' as a deprecated synonym for keyword usage.

That seem like overly complicated as now the actual exception object can be either in etype, value, or exc. 


Let my try to give example to see if I understood correctly

2.7 compat

    print_exception(etype, value, tb)
    print_exception(etype=etype, value=value, tb=tb) 

3.5 compat
    print_exception(None, value, tb)
    print_exception(etype=None, value=value, tb=tb)
                                      
3.7
    print_exception(value)              == print_exception(type(value), value, value.__traceback__)
    print_exception(value, tb=True)     == print_exception(type(value), value, value.__traceback__)

    print_exception(value, tb=None)     == print_exception(type(value), value, None)
    print_exception(value, tb=False)    == print_exception(type(value), value, None)


    print_exception(value, tb=faketb)   == print_exception(type(value), value, faketb)
                                  
    # tb can be positional

    print_exception(value, tb) == print_exception(value, tb=tb)

Signature would thus be:

    if first param isinstance BaseException: # 3.7+, prefered form
        print_exception(exc, [tb ,] *, [limit, file, chain])
    else:
        print_exception(etype, value, tb, [limit, file, chain])
        # etype being ignored

Should exc be positional only ?

    print_exception(exc, /, [tb ,] *, [limit, file, chain])

Should `limit`, `file`, `chain` be allowed to be positional ?

    print_exception(exc, [tb , limit, file, chain])
History
Date User Action Args
2017-03-03 05:30:00mbussonnsetrecipients: + mbussonn, brett.cannon, terry.reedy, martin.panter
2017-03-03 05:30:00mbussonnsetmessageid: <1488519000.39.0.726327261789.issue26389@psf.upfronthosting.co.za>
2017-03-03 05:30:00mbussonnlinkissue26389 messages
2017-03-03 05:29:59mbussonncreate