[New-bugs-announce] [issue14795] Pdb incorrectly handles a method breakpoint when module not imported

Xavier de Gaye report at bugs.python.org
Sun May 13 17:25:56 CEST 2012


New submission from Xavier de Gaye <xdegaye at gmail.com>:

In the following test, breakpoint 2 is set incorrectly at line 1 and
pdb does not know how to set a breakpoint on method C.c_foo. However
setting those two breakpoints on both methods is ok after the class
definition has been executed.


===   main.py   =================================
def foo():
    pass

class C:
    def c_foo(self):
        pass
    def foo(self):
        pass

foo()
=================================================
$ python3.1 -m pdb main.py
> /path_to/main.py(1)<module>()
-> def foo():
(Pdb) import sys; print(sys.version)
3.1.2 (r312:79147, Apr  4 2010, 17:46:48) 
[GCC 4.3.2]
(Pdb) break foo
Breakpoint 1 at /path_to/main.py:1
(Pdb) break C.foo
Breakpoint 2 at /path_to/main.py:1
(Pdb) break C.c_foo
*** The specified object 'C.c_foo' is not a function
or was not found along sys.path.
(Pdb) break 10
Breakpoint 3 at /path_to/main.py:10
(Pdb) continue
> /path_to/main.py(10)<module>()
-> foo()
(Pdb) break C.foo
Breakpoint 4 at /path_to/main.py:7
(Pdb) break C.c_foo
Breakpoint 5 at /path_to/main.py:5
(Pdb) quit
=================================================

The attached patch fixes the problem. The patch includes a test case.

----------
components: Library (Lib)
files: pdb_default.patch
keywords: patch
messages: 160517
nosy: xdegaye
priority: normal
severity: normal
status: open
title: Pdb incorrectly handles a method breakpoint when module not imported
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3
Added file: http://bugs.python.org/file25560/pdb_default.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14795>
_______________________________________


More information about the New-bugs-announce mailing list