bpo-26389: Allow traceback function to only get an exception instance (instead of 3 args)#327
bpo-26389: Allow traceback function to only get an exception instance (instead of 3 args)#327Carreau wants to merge 1 commit intopython:masterfrom
Conversation
Instead of having to pass type/value/tb separately, allow to pass `exc=ExceptionInstance()`
|
-1 on the patch as is. I posted my analysis and suggestions in msg288671 in https://bugs.python.org/issue26389. In brief, 'exc' and 'value' should be synonyms until 'value' is deleted, and 'tb' parameter should be kept with tb=True the default and meaning 'get tb from exc'. I consider the latter more important and the name change and 'etype' deletion. |
vstinner
left a comment
There was a problem hiding this comment.
You must document these changes in Doc/library/traceback.rst. Don't forget a ".. versionchanged:: 3.7" section.
|
|
||
| Since python 3.7, instead of passing *etype*, *value* and *tb* separately, | ||
| it is recommended to use the *exc* keyword argument which will infer all the | ||
| required values. |
There was a problem hiding this comment.
You should also document that the traceback object is now get from exc if tb is not set.
There was a problem hiding this comment.
I think this would be better off in the main RST documentation, rather than the doc strings. Normally the doc strings exclude finer details, changes from previous versions, etc.
|
|
||
| Since python 3.7, instead of passing *etype*, *value* and *tb* separately, | ||
| it is recommended to use the *exc* keyword argument which will infer all the | ||
| required values. |
|
|
||
| Since python 3.7, instead of passing *etype* and *value* separately, it is | ||
| recommended to use the *exc* keyword argument which will infer all the | ||
| required values. |
| elif exc: | ||
| value = exc | ||
| tb = exc.__traceback__ | ||
| etype = type(value) |
There was a problem hiding this comment.
It seems like these lines are duplicated 3 times: write a private helper function to factorize the code.
| occurred with a caret on the next line indicating the approximate | ||
| position of the error. | ||
|
|
||
| The *etype* parameter is ignored since python 3.5 and get inferred from |
| *value*. | ||
|
|
||
| Since python 3.7, instead of passing *etype*, *value* and *tb* separately, | ||
| it is recommended to use the *exc* keyword argument which will infer all the |
There was a problem hiding this comment.
it is recommended to use the exc keyword argument, which [specifies] all the required values.
|
|
||
| Since python 3.7, instead of passing *etype*, *value* and *tb* separately, | ||
| it is recommended to use the *exc* keyword argument which will infer all the | ||
| required values. |
There was a problem hiding this comment.
I think this would be better off in the main RST documentation, rather than the doc strings. Normally the doc strings exclude finer details, changes from previous versions, etc.
|
Thanks for the review. I think I'll restart that from scratch and use the approach describe in https://bugs.python.org/issue26389, basically using |
|
terryjreedy
left a comment
There was a problem hiding this comment.
Wait until API decided on.
|
To try and help move older pull requests forward, we are going through and backfilling 'awaiting' labels on pull requests that are lacking the label. Based on the current reviews, the best we can tell in an automated fashion is that a core developer requested changes to be made to this pull request. If/when the requested changes have been made, please leave a comment that says, |
Bumps [cachetools](https://github.com/tkem/cachetools) from 4.0.0 to 4.1.0. - [Release notes](https://github.com/tkem/cachetools/releases) - [Changelog](https://github.com/tkem/cachetools/blob/master/CHANGELOG.rst) - [Commits](tkem/cachetools@v4.0.0...v4.1.0) Signed-off-by: dependabot-preview[bot] <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Instead of having to pass type/value/tb separately, allow to pass
exc=ExceptionInstance()