Skip to content

Conversation

@Carreau
Copy link
Contributor

@Carreau Carreau commented Feb 27, 2017

Instead of having to pass type/value/tb separately, allow to pass
exc=ExceptionInstance()

Instead of having to pass type/value/tb separately, allow to pass
`exc=ExceptionInstance()`
@terryjreedy
Copy link
Member

-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.

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should also document that the traceback object is now get from exc if tb is not set.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

elif exc:
value = exc
tb = exc.__traceback__
etype = type(value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like these lines are duplicated 3 times: write a private helper function to factorize the code.

@vstinner vstinner changed the title bpo-26389: Allow some function in traceback to take instances. bpo-26389: Allow traceback function to only get an exception instance (instead of 3 args) Mar 2, 2017
@vstinner vstinner added the type-feature A feature request or enhancement label Mar 2, 2017
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gets inferred

*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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Carreau
Copy link
Contributor Author

Carreau commented Mar 2, 2017

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 etype to extract type/value/tb by still keeping old call possible.

@terryjreedy
Copy link
Member

using etype to extract ...
I am not sure what you mean, but etype should continue to be ignored as it is today. I think it premature to work more on a patch until we agree on the API, as I discussed on the issue.

@terryjreedy terryjreedy self-requested a review March 3, 2017 04:51
Copy link
Member

@terryjreedy terryjreedy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait until API decided on.

@brettcannon
Copy link
Member

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, I have made the requested changes; please review again. That will trigger a bot to flag this pull request as ready for a follow-up review.

@Carreau Carreau closed this May 27, 2020
klange pushed a commit to toaruos/cpython that referenced this pull request Sep 15, 2021
jaraco pushed a commit that referenced this pull request Dec 2, 2022
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>
@Carreau Carreau deleted the traceb branch October 20, 2025 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting changes type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants