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

request access to __file__ and __line__ perhaps via inspect.getframeinfo? #1054

Open
larryfast opened this issue Jul 24, 2018 · 0 comments
Open
Labels
cpython api modules from cpython enhancement
Milestone

Comments

@larryfast
Copy link

I want to add fname & lineno to my diagnostic messages. In normal python stackoverflow suggests I use the following: https://stackoverflow.com/questions/3711184/how-to-use-inspect-to-get-the-callers-info-from-callee-in-python
previous_frame = inspect.currentframe().f_back
(filename, line_number, function_name, lines, index) = inspect.getframeinfo(previous_frame)
return (filename, line_number, function_name, lines, index)

Original request posted in CircuitPython forum where tannewt2 wrote:
I don't think we expose that data yet. We do store it though. Please file a GitHub issue with how its done in CPython and hopefully someone will add it.

https://forums.adafruit.com/posting.php?mode=reply&f=60&t=138518

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cpython api modules from cpython enhancement
Projects
None yet
Development

No branches or pull requests

2 participants