GNU bug report logs - #45328
28.0.50; [PATCH] Compare raw syntax descriptors with equal in `python-indent-region'

Previous Next

Package: emacs;

Reported by: Andrea Corallo <akrl <at> sdf.org>

Date: Sat, 19 Dec 2020 23:05:02 UTC

Severity: normal

Found in version 28.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Andrea Corallo <akrl <at> sdf.org>
Cc: Fabián Ezequiel Gallina <fgallina <at> gnu.org>, 45328 <at> debbugs.gnu.org, Stefan Kangas <stefan <at> marxist.se>
Subject: bug#45328: 28.0.50; [PATCH] Compare raw syntax descriptors with equal in `python-indent-region'
Date: Mon, 17 May 2021 17:06:03 +0200
Andrea Corallo <akrl <at> sdf.org> writes:

> Uhmm, I thought the patch was correct but re-testing it this is now
> breaking the `python-indent-region-5' test.
>
> Maybe there's a reason why we should use eq there or maybe this is
> unveiling a real bug?  Not sure, I guess some expert of that code should
> probably have a look.

The code in question is:

                   ;; Don't mess with strings, unless it's the
                   ;; enclosing set of quotes or a docstring.
                   (or (not (python-syntax-context 'string))
                       (eq
                        (syntax-after
                         (+ (1- (point))
                            (current-indentation)
                            (python-syntax-count-quotes (char-after) (point))))
                        (string-to-syntax "|"))
                       (python-info-docstring-p))

That `eq' form will never return anything other than nil, so removing it
gives us identical results.  So I'm not quite sure what it's trying to
do -- it's probably meant to be `equal', but that will (as you've found
out) lead to mis-indenting some code.

So I've added Fabián to the CCs; perhaps he has some comments.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 3 years and 8 days ago.

Previous Next


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