GNU bug report logs - #21086
24.5; python.el: python-shell-buffer-substring fails under certain circumstances

Previous Next

Package: emacs;

Reported by: Yuri D'Elia <wavexx <at> thregr.org>

Date: Sat, 18 Jul 2015 16:14:02 UTC

Severity: normal

Merged with 21193

Found in version 25.0.50

Fixed in version 24.5

Done: fgallina <at> gnu.org (Fabián Ezequiel Gallina)

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: fgallina <at> gnu.org (Fabián Ezequiel Gallina)
Cc: tracker <at> debbugs.gnu.org
Subject: bug#21193: closed (25.0.50; python-shell-buffer-substring adds
 bogus if True: to unindented line)
Date: Sun, 23 Aug 2015 23:02:03 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sun, 23 Aug 2015 20:01:15 -0300
with message-id <874mjpip8k.fsf <at> gnu.org>
and subject line 24.5; python.el: python-shell-buffer-substring fails under certain circumstances
has caused the debbugs.gnu.org bug report #21086,
regarding 25.0.50; python-shell-buffer-substring adds bogus if True: to unindented line
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
21086: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21086
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Jorgen Schaefer <contact <at> jorgenschaefer.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.0.50;
 python-shell-buffer-substring adds bogus if True: to unindented line
Date: Wed, 05 Aug 2015 13:04:17 +0200
Hello!

The function `python-shell-buffer-substring' can get confused when it is
used to send a substring of a line. It tries to add if True: around an
indented piece of code to prevent indentation errors, but it fails at
detecting indented code correctly:

(with-temp-buffer
  (insert "def foo():\n"
          "    print('a')\n")
  (re-search-backward "print")
  (python-shell-buffer-substring (point) (point-at-eol) t))

=>

"if True:
print('a')"

Note that the "print" line in the resulting code is not indented.

The expected result would be either "print('a')" or
"if True:\n    print('a')".

Regards,
Jorgen


[Message part 3 (message/rfc822, inline)]
From: fgallina <at> gnu.org (Fabián Ezequiel Gallina)
To: 21086-done <at> debbugs.gnu.org
Subject: 24.5; python.el: python-shell-buffer-substring fails under certain
 circumstances
Date: Sun, 23 Aug 2015 20:01:15 -0300
Fixed in master at af013e0.

I installed a different patch that seems to be more robust on various
conditions (see tests).


Thanks for such detailed report,
Fabián.


This bug report was last modified 9 years and 332 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.