diff --git a/Lib/bdb.py b/Lib/bdb.py
--- a/Lib/bdb.py
+++ b/Lib/bdb.py
@@ -542,18 +542,13 @@
def checkfuncname(b, frame):
"""Check whether we should break here because of `b.funcname`."""
if not b.funcname:
- # Breakpoint was set via line number.
- if b.line != frame.f_lineno:
- # Breakpoint was set at a line with a def statement and the function
- # defined is called: don't break.
- return False
return True
# Breakpoint set via function name.
if frame.f_code.co_name != b.funcname:
# It's not a function call, but rather execution of def statement.
- return False
+ return True
# We are in the right frame.
if not b.func_first_executable_line:
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
@@ -667,6 +667,46 @@
any('main.py(5)foo()->None' in l for l in stdout.splitlines()),
'Fail to step into the caller after a return')
+ def test_XXX_1(self):
+ script = """
+ x = 1
+ def bar():
+ pass
+
+ bar()
+ """
+ commands = """
+ break bar
+ continue
+ continue
+ break
+ continue
+ """
+ stdout, stderr = self.run_pdb(script, commands)
+ self.assertTrue(
+ any('breakpoint already hit 2 times' in l for l in stdout.splitlines()),
+ 'Fail to stop at function definition')
+
+ def test_XXX_2(self):
+ script = """
+ x = 1
+ def bar():
+ pass
+
+ bar()
+ """
+ commands = """
+ break 3
+ continue
+ continue
+ break
+ continue
+ """
+ stdout, stderr = self.run_pdb(script, commands)
+ self.assertTrue(
+ any('breakpoint already hit 2 times' in l for l in stdout.splitlines()),
+ 'Fail to stop at breakpoint set on function definition')
+
def tearDown(self):
support.unlink(support.TESTFN)