Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34k
gh-143874: Fix pdb expression result output stream in_exec_in_closure()#143875
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Fixes an issue where results of expressions executed via`_exec_in_closure()` were written to `sys.stdout` insteadof the debugger output stream.Adds a regression test to ensure expression results areconsistently emitted via pdb.stdout.Signed-off-by: Yongtao Huang <yongtaoh2022@gmail.com>
cocolato commentedJan 15, 2026
I think the current test case doesn't actually test the remote debug mode. We need add some tests in cpython/Lib/test/test_remote_pdb.py Lines 832 to 833 inc461aa9
|
cocolato commentedJan 15, 2026 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Let's add some tests like this: classRemotePdbTestCase(unittest.TestCase): ...deftest_remote_closure_exec(self):self.pdb._exec_in_closure('(lambda: 123)()', {}, {})outputs=self.sockfile.get_output()messages= [o['message'].strip()foroinoutputsif'message'ino]self.assertIn("123",messages) |
hyongtao-code commentedJan 15, 2026
Thank you very much — I couldn’t agree more with your feedback. Before that, I spent a long time trying to find an appropriate place for the corresponding test case, and still didn’t get it right. <(_ _)> |
gaogaotiantian commentedJan 17, 2026
The issue is real but it's not because |
hyongtao-code commentedJan 18, 2026
Totally agree. The actual execution path is: self.message() →local pdb: print(..., file=self.stdout) → remote pdb: send over the socket Thank you for helping identify the RCA and clarifying the underlying cause–and–effect relationship. |
e66597d intopython:mainUh oh!
There was an error while loading.Please reload this page.
gaogaotiantian commentedJan 20, 2026
Thank you for the contribution! |
Thanks@hyongtao-code for the PR, and@gaogaotiantian for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
…losure()` (pythonGH-143875)(cherry picked from commite66597d)Co-authored-by: Yongtao Huang <yongtaoh2022@gmail.com>
GH-144061 is a backport of this pull request to the3.14 branch. |
Uh oh!
There was an error while loading.Please reload this page.
Fixes an issue where results of expressions executed via
_exec_in_closure()were written tosys.stdoutinstead of the debugger output stream. Adds a regression test to ensure expression results are consistently emitted viapdb.stdout.