Comment 5 for bug 709218

Revision history for this message
Andreas Roehler (a-roehler) wrote : Re: [Bug 709218] Re: pdbtrack fails for subclasses

Am 26.10.2011 12:18, schrieb <email address hidden>:
> Hi there, it's been ages since I filed this bug (and I actually switched
> from emacs to vi for my python work partly because of it! ... so I can't
> test it right now as I no longer have that emacs setup). However, I'm
> guessing the files should have looked something like this:
>
> [Animal.py]
> class Animal:
> def hello(self):
> print "hello"
>
> [Cat.py]
> from Animal import *
> class Cat(Animal):
> def hello(self):
> print "meow"
> a=b/8
>
> [main.py]
> from Cat import *
> c = Cat()
> c.hello() #causes error, but emacs tracking fails
>
>
> The point was that the tracking fell over when the error occurred inside a subclass method.
>
> Charles
>

Thanks a lot! May confirm the bug that way:

Current directory is MY-PATH/
 > MY-PATH/Main.py(4)<module>()
-> from Cat import *
(Pdb) n
 > MY-PATH/Main.py(5)<module>()
-> c = Cat()
(Pdb) n
 > MY-PATH/Main.py(6)<module>()
-> c.hello() #causes error, but emacs tracking fails
(Pdb) n
meow
NameError: "global name 'b' is not defined"

BTW had to make pdb working before

with the help of

PdbNotes from http://www.emacswiki.org/emacs/PdbNotes:

For running python in GdbMode you need to set the pdb-path variable in
.emacs or wherever.

The advice defaults to the current buffer name when invoking M-x pdb,
and comes from here:

http://lists.gnu.org/archive/html/help-gnu-emacs/2003-10/msg00577.html

The rest worked automagically in 22.2.1

  ;;pdb setup, note the python version
  (setq pdb-path '/usr/lib/python2.5/pdb.py
        gud-pdb-command-name (symbol-name pdb-path))
  (defadvice pdb (before gud-query-cmdline activate)
    "Provide a better default command line when called interactively."
    (interactive
     (list (gud-query-cmdline pdb-path
        (file-name-nondirectory buffer-file-name)))))