bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#11679: 24.1.50; gud/pdb3 hangs in lines with list comprehension


From: Stefan Kangas
Subject: bug#11679: 24.1.50; gud/pdb3 hangs in lines with list comprehension
Date: Mon, 9 Sep 2019 04:38:05 +0200

tags 11679 fixed
close 11679 27.1
quit

Andreas Politz <politza@fh-trier.de> writes:

> For list comprehensions pdb3 outputs a line like this.
>
>> FILE(LINE)<listcomp>()
>
> But the `listcomp' token is not captured by the `gud-pdb-marker-regexp',
> resulting in pdb appearing to be hanging.  (This may be python2/3
> related.)
>
> diff -c -L /usr/share/emacs/24.1.50/lisp/progmodes/gud.el.gz -L \#\<buffer\ 
> gud.el.gz\> /tmp/jka-com19603ZkZ /tmp/buffer-content-19603z4l
> *** /usr/share/emacs/24.1.50/lisp/progmodes/gud.el.gz
> --- #<buffer gud.el.gz>
> ***************
> *** 1567,1573 ****
>   ;; Last group is for return value, e.g. "> test.py(2)foo()->None"
>   ;; Either file or function name may be omitted: "> <string>(0)?()"
>   (defvar gud-pdb-marker-regexp
> !   "^> 
> \\([-a-zA-Z0-9_/.:\\]*\\|<string>\\)(\\([0-9]+\\))\\([a-zA-Z0-9_]*\\|\\?\\|<module>\\)()\\(->[^\n\r]*\\)?[\n\r]")
>
>   (defvar gud-pdb-marker-regexp-file-group 1)
>   (defvar gud-pdb-marker-regexp-line-group 2)
> --- 1567,1573 ----
>   ;; Last group is for return value, e.g. "> test.py(2)foo()->None"
>   ;; Either file or function name may be omitted: "> <string>(0)?()"
>   (defvar gud-pdb-marker-regexp
> !   "^> 
> \\([-a-zA-Z0-9_/.:\\]*\\|<string>\\)(\\([0-9]+\\))\\([a-zA-Z0-9_]*\\|\\?\\|<\\(?:module\\|listcomp\\)>\\)()\\(->[^\n\r]*\\)?[\n\r]")
>
>   (defvar gud-pdb-marker-regexp-file-group 1)
>   (defvar gud-pdb-marker-regexp-line-group 2)
>
> Diff finished.  Tue Jun 12 09:19:31 2012

I can reproduce this issue on current master, and it is indeed related
to the new code object names for anonymous objects in Python 3.

However, the fix you suggested was not complete, since it lacked
support for other common code objects.  I've therefore installed a
slightly different patch on master (see attached).

You could use the following Python 3 code to verify this fix:

# lambda
(lambda x: x + 1)(2)
# setcomp -- set comprehension
{s for s in [1, 2]}
# dictcomp -- dict comprehension
dict1 = {'a': 1, 'b': 2}
dict1_cond = {k:v for (k,v) in dict1.items() if v>2}
# listcomp -- list comprehension
[x*x for x in range(0,2)]
# genexpr -- generator expression
(x for x in range(5))
tuple(range(5))

Save the above as e.g. foo.py and run:

    M-x pdb RET python3 -m pdb foo.py RET

Then step through this to see output like this:

> /Users/skangas/wip/emacs/lisp/foo.py(7)<dictcomp>()
[...]
> /Users/skangas/wip/emacs/lisp/foo.py(11)<genexpr>()
[etc.]

AFAICT, the list I've installed is exhaustive, but if I've missed
something I'm sure someone will report a new bug report.  I'm
therefore closing this bug report as fixed.

Best regards,
Stefan Kangas

Attachment: 0001-Match-Python-3-code-object-names-in-M-x-pdb.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]