classification
Title: Pdb.checkline() attribute error when 'curframe' is None
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: erlendaasland, georg.brandl, iritkatriel, miss-islington, takluyver, xdegaye
Priority: normal Keywords: patch

Created on 2016-10-25 13:12 by takluyver, last changed 2021-05-12 09:08 by iritkatriel. This issue is now closed.

Files
File name Uploaded Description Edit
pdb-reset-checkline.patch takluyver, 2016-10-25 13:12 review
Pull Requests
URL Status Linked Edit
PR 25438 merged erlendaasland, 2021-04-16 12:42
PR 26050 merged miss-islington, 2021-05-11 23:26
PR 26051 closed miss-islington, 2021-05-11 23:26
PR 26053 merged erlendaasland, 2021-05-12 08:38
Messages (6)
msg279402 - (view) Author: Thomas Kluyver (takluyver) * Date: 2016-10-25 13:12
Pdb.checkline() does a hasattr() check to protect against self.curframe not existing. self.curframe can also be None (if self.forget() or self.reset() was called), but checkline() does not handle this.

The attached patch treats self.curframe == None as equivalent to the attribute being absent.

Background:
http://bugs.python.org/issue9230
https://github.com/ipython/ipython/issues/10028

(Georg, I've nosy-listed you as I saw your name on a couple of similar issues; I hope you don't mind)
msg393479 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-05-11 23:48
New changeset c90ed8e2e79ebd64f72c621b5a2ab06ec4c7210c by Miss Islington (bot) in branch '3.10':
bpo-28528: Fix pdb.checkline() attribute error when 'curframe' is None. (GH-25438) (#26050)
https://github.com/python/cpython/commit/c90ed8e2e79ebd64f72c621b5a2ab06ec4c7210c
msg393480 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-05-11 23:50
The 3.9 backport failed because of test failures like:

======================================================================
ERROR: test_checkline_is_not_executable (test.test_pdb.ChecklineTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\a\cpython\cpython\lib\test\test_pdb.py", line 1752, in tearDown
    os_helper.unlink(os_helper.TESTFN)
NameError: name 'os_helper' is not defined

----------------------------------------------------------------------
msg393487 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2021-05-12 08:41
Yes, test.os_helper was introduced in 3.10. I've manually cherry-picked 8563a7052ccd98e6a381d361664ce567afd5eb6e to 3.9 (GH-26053).
msg393488 - (view) Author: miss-islington (miss-islington) Date: 2021-05-12 09:04
New changeset 6c190b5ae5887d592bc8915148440a63da8b7cdd by Erlend Egeberg Aasland in branch '3.9':
[3.9] bpo-28528: Fix pdb.checkline() attribute error when 'curframe' is None (GH-25438) (GH-26053)
https://github.com/python/cpython/commit/6c190b5ae5887d592bc8915148440a63da8b7cdd
msg393490 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-05-12 09:08
Thank you Erlend!
History
Date User Action Args
2021-05-12 09:08:56iritkatrielsetstatus: open -> closed
resolution: fixed
messages: + msg393490

stage: patch review -> resolved
2021-05-12 09:04:23miss-islingtonsetmessages: + msg393488
2021-05-12 08:41:16erlendaaslandsetmessages: + msg393487
2021-05-12 08:38:38erlendaaslandsetpull_requests: + pull_request24693
2021-05-11 23:50:37iritkatrielsetmessages: + msg393480
2021-05-11 23:48:12iritkatrielsetnosy: + iritkatriel
messages: + msg393479
2021-05-11 23:26:43miss-islingtonsetpull_requests: + pull_request24691
2021-05-11 23:26:39miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request24690
2021-05-11 23:24:32iritkatrielsettitle: Pdb.checkline() attribute error when 'curframe' is missing -> Pdb.checkline() attribute error when 'curframe' is None
2021-05-11 21:41:40iritkatrielsettitle: Pdb.checkline() -> Pdb.checkline() attribute error when 'curframe' is missing
2021-05-11 21:41:01iritkatrielsetversions: + Python 3.9, Python 3.10, Python 3.11, - Python 3.5, Python 3.6, Python 3.7
2021-04-16 12:42:08erlendaaslandsetnosy: + erlendaasland

pull_requests: + pull_request24168
stage: patch review
2016-10-27 18:19:54xdegayesetnosy: + xdegaye
2016-10-25 13:12:03takluyvercreate