[3.13] gh-59000: Fix pdb breakpoint resolution for class methods when… (#142172)
Some checks are pending
Tests / (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / Docs (push) Blocked by required conditions
Tests / Change detection (push) Waiting to run
Tests / Check if the ABI has changed (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / Android (aarch64) (push) Blocked by required conditions
Tests / Android (x86_64) (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Sanitizers (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run

* [3.13] gh-59000: Fix pdb breakpoint resolution for class methods when module not imported (GH-141949)
(cherry picked from commit 5e58548ebe)

Co-authored-by: LloydZ <35182391+cocolato@users.noreply.github.com>
This commit is contained in:
Tian Gao 2025-12-01 21:07:52 -08:00 committed by GitHub
parent 01393ffbe6
commit 9d99b5b2ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 1 deletions

View file

@ -1262,7 +1262,9 @@ class Pdb(bdb.Bdb, cmd.Cmd):
f = self.lookupmodule(parts[0])
if f:
fname = f
item = parts[1]
item = parts[1]
else:
return failed
answer = find_function(item, self.canonic(fname))
return answer or failed

View file

@ -4013,6 +4013,22 @@ def bœr():
self.assertIn('42', stdout)
self.assertIn('return x + 1', stdout)
def test_issue_59000(self):
script = """
def foo():
pass
class C:
def foo(self):
pass
"""
commands = """
break C.foo
quit
"""
stdout, stderr = self.run_pdb_script(script, commands)
self.assertIn("The specified object 'C.foo' is not a function", stdout)
class ChecklineTests(unittest.TestCase):
def setUp(self):

View file

@ -0,0 +1 @@
Fix :mod:`pdb` breakpoint resolution for class methods when the module defining the class is not imported.