Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: add stack_frame kwarg to deprecated decorator #2046

Merged
merged 2 commits into from
Mar 28, 2021

Conversation

dgw
Copy link
Member

@dgw dgw commented Mar 27, 2021

Description

Allows specifying which stack frame to show in the traceback, if the default (the most recent) isn't helpful. Sometimes the parent caller or a more distant ancestor is more informative to the end user.

Checklist

  • I have read CONTRIBUTING.md
  • I can and do license this contribution under the EFLv2
  • No issues are reported by make qa (runs make quality and make test)
  • I have tested the functionality of the things this change touches

Notes

Inspired by challenges encountered when working on #2044. This should be merged first if approved.

I seriously considered making stack_frame just a plain integer, and not requiring the negative sign, just because 99% (maybe even 100%) of all use cases are going to want a frame relative to the end of the list generated by traceback.extract_stack(). But it's more intuitive to make the argument the same value as the list index used inside the decorator…

dgw added 2 commits March 27, 2021 15:13
Allows specifying which stack frame to show in the traceback, if the
default (the most recent) isn't helpful. Sometimes the parent caller
or a more distant ancestor is more informative to the end user.
@dgw dgw added the Feature label Mar 27, 2021
@dgw dgw added this to the 7.1.0 milestone Mar 27, 2021
@dgw dgw requested a review from a team March 27, 2021 22:15
Copy link
Contributor

@Exirel Exirel left a comment

Choose a reason for hiding this comment

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

I love it.

@dgw dgw merged commit 96c55af into master Mar 28, 2021
@dgw dgw deleted the deprecated-stack-frame branch March 28, 2021 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants