An Emacs mode for editing Python code

pdbtrack is broken

Reported by Barry Warsaw on 2011-09-23
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-mode.el
Medium
Andreas Roehler

Bug Description

Add this to a line of your code:

import pdb; pdb.set_trace()

Now run it from a shell buffer. When you hit the breakpoint, pdbtrack should kick in but instead you get:

pdbtrack: Traceback cue not found

I'm using Python 2.7

Changed in python-mode:
assignee: nobody → Andreas Roehler (a-roehler)
Andreas Roehler (a-roehler) wrote :
Download full text (3.5 KiB)

Hi Barry,

using this daily, didn't notice such a bug neither with Emacs-24... nor Emacs-23... .

The following script pdbtrack.py

#############

#! /usr/bin/env python
# -*- coding: utf-8 -*-

import pdb

pdb.set_trace()
news = "pdbtrack is broken python-mode.el, lp:857003"

print "news: %s " % news

#############

prints nicely:

(Pdb) s
> MY_PATH/pdbtrack.py(9)<module>()
-> print "news: %s " % news
(Pdb) p news
'pdbtrack is broken python-mode.el, lp:857003'
(Pdb)

############

send you extract of M-x describe-mode below

Please send output from

Emacs -Q, M-x report-emacs-bug

should you need further investigation.

Cheers,

Andreas

############

(Information about these minor modes follows the major mode info.)

Python mode defined in `python-mode.el':
Major mode for editing Python files.
To submit a problem report, enter `C-c C-b' from a
`python-mode' buffer. Do `C-c ?' for detailed
documentation. To see what version of `python-mode' you are running,
enter `C-c C-v'.

This mode knows about Python indentation, tokens, comments and
continuation lines. Paragraphs are separated by blank lines only.

COMMANDS
key binding
--- -------

C-c Prefix Command
C-j py-newline-and-indent
C-x Prefix Command
ESC Prefix Command
# py-electric-comment
% py-match-paren
: py-electric-colon
s-TAB ar-count-parentized-in-singlequoted-atpt
s-S hs-show-all
s-f ar-forward-python-expression-atpt
s-o zu-indent
s-q ar-python-expression-atpt
s-s hs-hide-all
s-ß py-expression-atpt
<C-backspace> py-hungry-delete-backwards
<backspace> py-electric-backspace
<delete> py-electric-delete
<return> py-newline-and-indent
<s-backspace> ar-py-outdent-line

C-x n Prefix Command

C-M-a py-beginning-of-def-or-class
C-M-e py-end-of-def-or-class
C-M-h py-mark-def-or-class
C-M-x py-execute-def-or-class
M-n py-end-of-statement
M-p py-beginning-of-statement

C-c C-a py-mark-statement
C-c C-b py-submit-bug-report
C-c C-c py-execute-buffer
C-c C-d py-pdbtrack-toggle-stack-tracking
C-c C-e py-describe-symbol
C-c C-f py-sort-imports
C-c C-k py-mark-block-or-clause
C-c C-l py-shift-left
C-c RET py-execute-import-or-reload
C-c C-n py-end-of-statement
C-c C-p py-beginning-of-statement
C-c C-q py-end-of-block
C-c C-r py-shift-right
C-c C-s py-execute-string
C-c C-t py-toggle-shells
C-c C-u py-beginning-of-block
C-c C-v py-version
C-c C-w py-pychecker-run
C-c ! py-shell
C-c # py-comment-region
C-c - py-up-exception
C-c / py-indent-line-outmost
C-c : py-guess-indent-offset
C-c < py-shift-left
C-c = py-down-exception
C-c > py-shift-right
C-c ? py-describe-mode
C-c c py-compute-indentation
C-c p druck
C-c | py-execute-region
C-c <delete> py-...

Read more...

On Sep 23, 2011, at 06:07 AM, Andreas Roehler wrote:

>using this daily, didn't notice such a bug neither with Emacs-24... nor
>Emacs-23... .

Hmm. I just tried it again with r599 and it's still not working for me.
Perhaps try a longer example?

>prints nicely:
>
>(Pdb) s
>> MY_PATH/pdbtrack.py(9)<module>()
>-> print "news: %s " % news
>(Pdb) p news
>'pdbtrack is broken python-mode.el, lp:857003'
>(Pdb)

Yes, but the question is whether you get the nice gud-like cursor following
listing in the other buffer? I don't anymore.

>send you extract of M-x describe-mode below
>
>Please send output from
>
>Emacs -Q, M-x report-emacs-bug

In GNU Emacs 23.3.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.5)
 of 2011-08-14 on allspice, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11004000
configured using `configure '--build' 'x86_64-linux-gnu' '--build' 'x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.3/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.3/leim' '--with-crt-dir=/usr/lib/x86_64-linux-gnu' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: en_US.UTF-8
  value of $LC_CTYPE: en_US.UTF-8
  value of $LC_MESSAGES: en_US.UTF-8
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Mail

Minor modes in effect:
  shell-dirtrack-mode: t
  delete-selection-mode: t
  icomplete-mode: t
  erc-spelling-mode: t
  flyspell-mode: t
  erc-services-mode: t
  erc-ring-mode: t
  erc-networks-mode: t
  erc-netsplit-mode: t
  erc-menu-mode: t
  erc-list-mode: t
  erc-pcomplete-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-autojoin-mode: t
  show-paren-mode: t
  savehist-mode: t
  rcirc-track-minor-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-match-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  desktop-save-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Andreas Roehler (a-roehler) wrote :

Am 23.09.2011 22:07, schrieb Barry Warsaw:
> On Sep 23, 2011, at 06:07 AM, Andreas Roehler wrote:
>
>> using this daily, didn't notice such a bug neither with Emacs-24... nor
>> Emacs-23... .
>
> Hmm. I just tried it again with r599 and it's still not working for me.
> Perhaps try a longer example?
>
>> prints nicely:
>>
>> (Pdb) s
>>> MY_PATH/pdbtrack.py(9)<module>()
>> -> print "news: %s " % news
>> (Pdb) p news
>> 'pdbtrack is broken python-mode.el, lp:857003'
>> (Pdb)
>
> Yes, but the question is whether you get the nice gud-like cursor following
> listing in the other buffer? I don't anymore.
>
>> send you extract of M-x describe-mode below
>>
>> Please send output from
>>
>> Emacs -Q, M-x report-emacs-bug
>
> In GNU Emacs 23.3.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.5)
> of 2011-08-14 on allspice, modified by Debian
> Windowing system distributor `The X.Org Foundation', version 11.0.11004000
> configured using `configure '--build' 'x86_64-linux-gnu' '--build' 'x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.3/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.3/leim' '--with-crt-dir=/usr/lib/x86_64-linux-gnu' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''
>
> Important settings:
> value of $LC_ALL: nil
> value of $LC_COLLATE: en_US.UTF-8
> value of $LC_CTYPE: en_US.UTF-8
> value of $LC_MESSAGES: en_US.UTF-8
> value of $LC_MONETARY: nil
> value of $LC_NUMERIC: nil
> value of $LC_TIME: nil
> value of $LANG: en_US.UTF-8
> value of $XMODIFIERS: nil
> locale-coding-system: utf-8-unix
> default enable-multibyte-characters: t
>
> Major mode: Mail

don't see python-mode

close this report?

Cheers

>
> Minor modes in effect:
> shell-dirtrack-mode: t
> delete-selection-mode: t
> icomplete-mode: t
> erc-spelling-mode: t
> flyspell-mode: t
> erc-services-mode: t
> erc-ring-mode: t
> erc-networks-mode: t
> erc-netsplit-mode: t
> erc-menu-mode: t
> erc-list-mode: t
> erc-pcomplete-mode: t
> erc-button-mode: t
> erc-fill-mode: t
> erc-stamp-mode: t
> erc-autojoin-mode: t
> show-paren-mode: t
> savehist-mode: t
> rcirc-track-minor-mode: t
> erc-track-mode: t
> erc-track-minor-mode: t
> erc-match-mode: t
> erc-irccontrols-mode: t
> erc-noncommands-mode: t
> erc-move-to-prompt-mode: t
> erc-readonly-mode: t
> desktop-save-mode: t
> tooltip-mode: t
> mouse-wheel-mode: t
> file-name-shadow-mode: t
> global-font-lock-mode: t
> font-lock-mode: t
> auto-encryption-mode: t
> auto-compression-mode: t
> column-number-mode: t
> line-number-mode: t
> transient-mark-mode: t
>

Barry Warsaw (barry) wrote :

Here's the problem as far as I can see. python-mode.el has two definitions
for py-pdbtrack-stack-entry-regexp:

;; pdbtrack constants
(defconst py-pdbtrack-stack-entry-regexp
; "^> \\([^(]+\\)(\\([0-9]+\\))\\([?a-zA-Z0-9_]+\\)()"
  "^> \\(.*\\)(\\([0-9]+\\))\\([?a-zA-Z0-9_<>]+\\)()"
  "Regular expression pdbtrack uses to find a stack trace entry.")

(defconst py-pdbtrack-stack-entry-regexp
  "^(\\([-a-zA-Z0-9_/.]*\\):\\([0-9]+\\)):[ \t]?\\(.*\n\\)"
  "Regular expression pdbtrack uses to find a stack trace entry for pydb.

The debugger outputs program-location lines that look like this:
   (/usr/bin/zonetab2pot.py:15): makePOT")

I'm not sure why there are two defconsts here, but the second one is
overriding the first one. The first one works fine for me, i.e. if I

(setq py-pdbtrack-stack-entry-regexp
      "^> \\(.*\\)(\\([0-9]+\\))\\([?a-zA-Z0-9_<>]+\\)()")

tracking works again.

Andreas Roehler (a-roehler) wrote :

Am 25.09.2011 23:02, schrieb Barry Warsaw:
> Here's the problem as far as I can see. python-mode.el has two definitions
> for py-pdbtrack-stack-entry-regexp:
>
> ;; pdbtrack constants
> (defconst py-pdbtrack-stack-entry-regexp
> ; "^> \\([^(]+\\)(\\([0-9]+\\))\\([?a-zA-Z0-9_]+\\)()"
> "^> \\(.*\\)(\\([0-9]+\\))\\([?a-zA-Z0-9_<>]+\\)()"
> "Regular expression pdbtrack uses to find a stack trace entry.")
>
> (defconst py-pdbtrack-stack-entry-regexp
> "^(\\([-a-zA-Z0-9_/.]*\\):\\([0-9]+\\)):[ \t]?\\(.*\n\\)"
> "Regular expression pdbtrack uses to find a stack trace entry for pydb.
>
> The debugger outputs program-location lines that look like this:
> (/usr/bin/zonetab2pot.py:15): makePOT")
>

the second must result from applying the pydb-patch lp:328837

> I'm not sure why there are two defconsts here, but the second one is
> overriding the first one. The first one works fine for me, i.e. if I
>
> (setq py-pdbtrack-stack-entry-regexp
> "^> \\(.*\\)(\\([0-9]+\\))\\([?a-zA-Z0-9_<>]+\\)()")
>
> tracking works again.
>

remains the question, why it works here...

Changed in python-mode:
milestone: none → 6.0.3
importance: Undecided → Medium
status: New → Fix Committed
Changed in python-mode:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers