Re: [issue13183] pdb skips frames after hitting a breakpoint and running step
Georg Brandl ge...@python.org added the comment: Should be fixed now. Thanks for the commit fix, Georg. The comment on buildbot failures had escaped my attention. Sorry for that. ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13183] pdb skips frames after hitting a breakpoint and running step
Xavier de Gaye xdeg...@gmail.com added the comment: Note that now that this issue is fixed, issue 14743 has become more visible. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13183 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13183] pdb skips frames after hitting a breakpoint and running step
Antoine Pitrou pit...@free.fr added the comment: If the failures don't get fixed, the offending commit should be reverted. -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13183 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13183] pdb skips frames after hitting a breakpoint and running step
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset e275a9f7daa9 by Georg Brandl in branch '3.2': #13183: backport fixes to test_pdb to 3.2 branch http://hg.python.org/cpython/rev/e275a9f7daa9 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13183 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13183] pdb skips frames after hitting a breakpoint and running step
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 2644e4ea02d3 by Georg Brandl in branch '2.7': #13183: backport fixes to test_pdb to 2.7 branch http://hg.python.org/cpython/rev/2644e4ea02d3 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13183 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13183] pdb skips frames after hitting a breakpoint and running step
Georg Brandl ge...@python.org added the comment: Should be fixed now. -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13183 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13183] pdb skips frames after hitting a breakpoint and running step
Charles-François Natali neolo...@free.fr added the comment: All 3.2 and 2.7 buildbots are still broken: http://python.org/dev/buildbot/all/builders/x86 OpenIndiana 3.2/builds/1080 == FAIL: test_issue13183 (test.test_pdb.PdbTestCase) -- Traceback (most recent call last): File /export/home/buildbot/32bits/3.2.cea-indiana-x86/build/Lib/test/test_pdb.py, line 662, in test_issue13183 'Fail to step into the caller after a return') AssertionError: 'main.py(5)foo()-None' not found in '- bar()' : Fail to step into the caller after a return -- Ran 2 tests in 0.558s -- nosy: +neologix status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13183 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13183] pdb skips frames after hitting a breakpoint and running step
Xavier de Gaye xdeg...@gmail.com added the comment: The test has been changed in the default branch by changeset 1b174a117e19. This change replaces the assertIn by a less restrictive assertTrue. These changes should also probably be made in 3.2 and 2.7 and hopefully this will fix the problem in 3.2 and 2.7. The changeset 1b174a117e19 in the default branch is: diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py --- a/Lib/test/test_pdb.py +++ b/Lib/test/test_pdb.py @@ -604,6 +604,7 @@ filename = 'main.py' with open(filename, 'w') as f: f.write(textwrap.dedent(script)) +self.addCleanup(support.unlink, filename) cmd = [sys.executable, '-m', 'pdb', filename] stdout = stderr = None with subprocess.Popen(cmd, stdout=subprocess.PIPE, @@ -660,9 +661,11 @@ with open('bar.py', 'w') as f: f.write(textwrap.dedent(bar)) +self.addCleanup(support.unlink, 'bar.py') stdout, stderr = self.run_pdb(script, commands) -self.assertIn('main.py(5)foo()-None', stdout.split('\n')[-3], - 'Fail to step into the caller after a return') +self.assertTrue( +any('main.py(5)foo()-None' in l for l in stdout.splitlines()), +'Fail to step into the caller after a return') -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13183 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13183] pdb skips frames after hitting a breakpoint and running step
Martin v. Löwis mar...@v.loewis.de added the comment: The test fails on Windows. Whereas on Unix, the two step commands produce this output: - print('1') (Pdb) step 1 --Return-- /net/pao/export/home/staff/loewis/work/33/bar.py(2)bar()-None - print('1') (Pdb) step --Return-- /net/pao/export/home/staff/loewis/work/33/main.py(5)foo()-None - bar() (Pdb) quit on Windows, they produce this output: - print('1') (Pdb) step --Call-- c:\users\martin\33\python\lib\encodings\cp850.py(18)encode() - def encode(self, input, final=False): (Pdb) step c:\users\martin\33\python\lib\encodings\cp850.py(19)encode() - return codecs.charmap_encode(input,self.errors,encoding_map)[0] (Pdb) quit I.e. the stepping enters the print, and breaks in the codec. Reopening the issue. -- nosy: +loewis status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13183 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13183] pdb skips frames after hitting a breakpoint and running step
Xavier de Gaye xdeg...@gmail.com added the comment: My fault :( The call to print is useless for the test, so I suggest to replace it with a plain 'pass' statement. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13183 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13183] pdb skips frames after hitting a breakpoint and running step
Martin v. Löwis mar...@v.loewis.de added the comment: That indeed makes the test pass. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13183 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13183] pdb skips frames after hitting a breakpoint and running step
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 3b2aa777b725 by Senthil Kumaran in branch '2.7': fix windows test failure - issue13183 http://hg.python.org/cpython/rev/3b2aa777b725 New changeset d17ecee3f752 by Senthil Kumaran in branch '3.2': fix windows test failure - issue13183 http://hg.python.org/cpython/rev/d17ecee3f752 New changeset 0269c592c8b1 by Senthil Kumaran in branch 'default': fix closes issue13183 - windows test failure http://hg.python.org/cpython/rev/0269c592c8b1 -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13183 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13183] pdb skips frames after hitting a breakpoint and running step
Senthil Kumaran sent...@uthcode.com added the comment: Fixed again with replacing print with pass. But it is strange behavior that stepping through enters print in Windows and does not so in Unix. What's the difference in windows that could cause this? Not sure if this was expected behavior. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13183 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13183] pdb skips frames after hitting a breakpoint and running step
Martin v. Löwis mar...@v.loewis.de added the comment: But it is strange behavior that stepping through enters print in Windows and does not so in Unix. What's the difference in windows that could cause this? Not sure if this was expected behavior. On Unix, the codec most likely is UTF-8, which is directly written in C, i.e. doesn't support Python single-stepping. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13183 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13183] pdb skips frames after hitting a breakpoint and running step
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 6c9ce7e34511 by Martin v. Löwis in branch 'default': Issue #13183: Revert 0b53b70a40a0 (reenable test on windows) http://hg.python.org/cpython/rev/6c9ce7e34511 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13183 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13183] pdb skips frames after hitting a breakpoint and running step
Senthil Kumaran sent...@uthcode.com added the comment: Hello Xavier, This issue required some tracing through the calls and I see the problem that you have mentioned and patch fixes the problem. One comment on the patch, for the tests in the module, this line - self.frame_returning = None does not seem to have a coverage. Is there a specific significance in setting this to None and would a test help? def dispatch_return(self, frame, arg): if self.stop_here(frame) or frame == self.returnframe: +self.frame_returning = frame self.user_return(frame, arg) +self.frame_returning = None if self.quitting: raise BdbQuit return self.trace_dispatch Sorry for the delay, I shall commit the fix in 3.3. -- assignee: - orsenthil ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13183 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13183] pdb skips frames after hitting a breakpoint and running step
Xavier de Gaye xdeg...@gmail.com added the comment: Hi Senthil, Thanks for your help with this issue. self.frame_returning is both a flag to indicate that we are returning from the current frame and a value (the current frame). We need both as set_step() (the method invoked when the user runs the step command) does not know the current frame and wether we are returning from the current frame. Here is a raw sketch of the call chain in the case where the user types the step command on returning from the current frame (Pdb subclasses both bdb.Bdb and cmd.Cmd): Bdb::dispatch_return Pdb::user_return (Bdb overriden method) Pdb::interaction Cmd::cmdloop Cmd::onecmd Pdb::do_step Bdb::set_step So self.frame_returning must be set to None after the call to self.user_return() so that its value is not used in another later step command, where we are not returning from this frame. Actually it is more explicit and more robust to use a try-finally clause, such as: def dispatch_return(self, frame, arg): if self.stop_here(frame) or frame == self.returnframe: try: self.frame_returning = frame self.user_return(frame, arg) finally: self.frame_returning = None if self.quitting: raise BdbQuit return self.trace_dispatch Xavier -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13183 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13183] pdb skips frames after hitting a breakpoint and running step
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 96cb47f8142e by Senthil Kumaran in branch '3.2': issue13183 - Fix pdb skipping frames after hitting a breakpoint and running step. Patch by Xavier de Gaye http://hg.python.org/cpython/rev/96cb47f8142e New changeset 5ea23739e9ba by Senthil Kumaran in branch '2.7': issue13183 - Fix pdb skipping frames after hitting a breakpoint and running step. Patch by Xavier de Gaye http://hg.python.org/cpython/rev/5ea23739e9ba New changeset ab63e874265e by Senthil Kumaran in branch 'default': issue13183 - Fix pdb skipping frames after hitting a breakpoint and running step. Patch by Xavier de Gaye http://hg.python.org/cpython/rev/ab63e874265e -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13183 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13183] pdb skips frames after hitting a breakpoint and running step
Senthil Kumaran sent...@uthcode.com added the comment: Hello Xavier, Thanks for the explanation. Understood the reason for setting the frame_returning to None. The patch is committed in all python versions and the issue is fixed now. Thanks for the patch and prodding through this. -- Senthil -- resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13183 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13183] pdb skips frames after hitting a breakpoint and running step
Changes by Tshepang Lekhonkhobe tshep...@gmail.com: -- nosy: +tshepang ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13183 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13183] pdb skips frames after hitting a breakpoint and running step
Senthil Kumaran sent...@uthcode.com added the comment: It's an interesting issue. Thanks for the report and patch, Xavier. I am setting patch to needing review. -- keywords: +needs review -patch nosy: +orsenthil versions: +Python 2.7, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13183 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13183] pdb skips frames after hitting a breakpoint and running step
Xavier de Gaye xdeg...@gmail.com added the comment: This message is just a reminder that this 4 months old issue raises the point that the step command in pdb is broken. A patch and test case have been proposed. No comment so far. As the author of pyclewn, a Vim front end to pdb and gdb, I would be grateful for any progress on this problem. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13183 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13183] pdb skips frames after hitting a breakpoint and running step
Changes by Meador Inge mead...@gmail.com: -- nosy: +meador.inge ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13183 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13183] pdb skips frames after hitting a breakpoint and running step
Xavier de Gaye xdeg...@gmail.com added the comment: Uploaded restore_trace_2.patch that improves the test case. -- Added file: http://bugs.python.org/file23418/restore_trace_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13183 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13183] pdb skips frames after hitting a breakpoint and running step
Xavier de Gaye xdeg...@gmail.com added the comment: Uploaded restore_trace.py27.patch with a fix and test case for python 2.7. -- Added file: http://bugs.python.org/file23419/restore_trace.py27.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13183 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13183] pdb skips frames after hitting a breakpoint and running step
Changes by Georg Brandl ge...@python.org: -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13183 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13183] pdb skips frames after hitting a breakpoint and running step
New submission from Xavier de Gaye xdeg...@gmail.com: Pdb skips frames after hitting a breakpoint and running step commands that walk back the frame stack. Run the following two tests with the two files named foo.py and bar.py: === foo.py from bar import bar def foo(): bar() def nope(): pass def foobar(): foo() nope() foobar() === bar.py def bar(): print('1') === test_1 $ python3 --version Python 3.2 $ python3 -m pdb foo.py /path/to/foo.py(1)module() - from bar import bar (Pdb) from bar import bar (Pdb) break bar Breakpoint 1 at /path/to/bar.py:1 (Pdb) continue /path/to/bar.py(2)bar() - print('1') (Pdb) step 1 --Return-- /path/to/bar.py(2)bar()-None - print('1') (Pdb) step --Call-- /path/to/foo.py(6)nope() - def nope(): (Pdb) === test_2 $ python3 -m pdb foo.py /path/to/foo.py(1)module() - from bar import bar (Pdb) break nope Breakpoint 1 at /path/to/foo.py:6 (Pdb) from bar import bar (Pdb) break bar Breakpoint 2 at /path/to/bar.py:1 (Pdb) continue /path/to/bar.py(2)bar() - print('1') (Pdb) step 1 --Return-- /path/to/bar.py(2)bar()-None - print('1') (Pdb) step --Return-- /path/to/foo.py(4)foo()-None - bar() (Pdb) === Note: stop_here, break_anywhere and dispatch_call are methods of the Bdb class. test_1 fails to stop in foo() after the second 'step' command because the trace function is not set for all the frames being created in the foo module, since stop_here() and break_anywhere() are both False whenever dispatch_call() is invoked in this module. So after the second 'step' command, trace_dispatch is not invoked by the interpreter until a new frame is created, which happens when nope() is called. test_2 succeeds and stops in foo() after the second 'step' command. After setting the dummy breakpoint 1 in the foo module in test_2, break_anywhere() becomes True in the foo module and the trace function is set for all the frames created in this module (with an associated performance penalty). The problem exists in all python versions. The attached patch fixes this problem by restoring the trace function on returning from a frame when the command is 'step'. The patch includes a test case. -- components: Library (Lib) files: restore_trace.patch keywords: patch messages: 145557 nosy: xdegaye priority: normal severity: normal status: open title: pdb skips frames after hitting a breakpoint and running step versions: Python 3.2 Added file: http://bugs.python.org/file23410/restore_trace.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13183 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13183] pdb skips frames after hitting a breakpoint and running step
Changes by Xavier de Gaye xdeg...@gmail.com: -- type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13183 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com