Comment 0 for bug 1938612

Revision history for this message
Al. Go. (yupyup442) wrote :

Description:

Editing the source file in Python mode before a line with an error results in the incorrect jump when clicking on the error line in inferior Python mode. Same when pressing RET on the error line. It seems that python-mode.el compensates for that edit twice (adding lines before the error sends me TOO FAR DOWN instead of up, by the amount of added lines). Reproducing with minimal example works 90% of the time, but not 100%. Tested with emacs -q, so it's not my .emacs config.

Versions:
$ emacs --version
GNU Emacs 26.1
$ apt-cache policy emacs
emacs:
  Installed: 1:26.1+1-3.2+deb10u2
$ uname -a
Linux [...] 4.19.0-17-amd64 #1 SMP Debian 4.19.194-2 (2021-06-21) x86_64 GNU/Linux

From C-h m in inferior mode:
Inferior Python mode defined in ‘python.el’
Clicking sends me to:
/usr/share/emacs/26.1/lisp/progmodes/python.el.gz

Steps to reproduce:

If I create a file t.py containing:

#1
assert False
#b
#c

Then visit it in emacs with Python mode and start an inferior Python mode with C-c C-p then run the file with C-c C-c, the inferior mode buffer shows:

"File "[...]/t.py", line 2, in <module>

Which is correct, and clicking on that line takes me to the "assert False" line in the Python mode buffer, which is correct.

BUT, if I then edit the source file by adding or removing lines before the error, for example:

#1
#2
assert False
#b
#c

the inferior mode buffer now shows:

"File "[...]/t.py", line 3, in <module>

Which is still correct, but clicking on it now sends me to line 4 (#b) instead of line 3. If I instead edit the file as such:

#1
#2
#3
assert False
#b
#c

the inferior mode buffer now shows:

"File "[...]/t.py", line 4, in <module>

But clicking on it now sends me to line 5 (#c), and so on.