Subject: Re: bug#45328: 28.0.50; [PATCH] Compare raw syntax descriptors with equal in `python-indent-region'

From: Lars Ingebrigtsen <[email-masked]>
Date: Mon, 17 May 2021 17:06:03 +0200

Andrea Corallo <[email-masked]> 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