gh-91462: Make lltrace output human-readable.#91463
Conversation
|
Example output: DetailsIn example.py: __ltrace__ = 1
def gen():
yield 10
yield 20
def main():
for x in gen():
x = x * x
print(x)
main()Result: |
gvanrossum
left a comment
There was a problem hiding this comment.
I like this a lot. Thanks, it will be much more useful now!
| @unittest.skipUnless(Py_DEBUG, "lltrace requires Py_DEBUG") | ||
| class TestLLTrace(unittest.TestCase): | ||
|
|
||
| def run_code(self, code): |
There was a problem hiding this comment.
(Surprised there isn't already a utility for this.)
| x = 42 | ||
| y = -x | ||
| dont_trace_1() | ||
| __ltrace__ = 1 |
There was a problem hiding this comment.
This tripped me over! :-) It almost seems like a bug that the feature is called LLTRACE but the dunder is __ltrace__...
There was a problem hiding this comment.
It seems to be a decade-old typo introduced here: 3c1e481
We could maybe accept both __ltrace__ and __lltrace__ at this point?
There was a problem hiding this comment.
Eh, just change to __lltrace__. This feature is too niche to require backward compatibility (nobody complained when it was broken 10 years ago :-).
gvanrossum
left a comment
There was a problem hiding this comment.
Don't change a thing! Land it.
|
I'll do the |
|
Thanks for the reviews! |
resume_frame:#91462