* [3.13] gh-59000: Fix pdb breakpoint resolution for class methods when module not imported (GH-141949)
(cherry picked from commit
5e58548ebe8f7ac8c6cb0bad775912caa4090515)
Co-authored-by: LloydZ <35182391+cocolato@users.noreply.github.com>
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
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):
--- /dev/null
+Fix :mod:`pdb` breakpoint resolution for class methods when the module defining the class is not imported.\r