Subject: bug#39598: 26.3; Emacs is extremely unresponsive on a trivial python file

From: Lars Ingebrigtsen <[email-masked]>
Date: Sun, 20 Sep 2020 10:47:23 +0200

Noam Postavsky <[email-masked]> writes:

> So any repetitions of the while loop after the second one are useless.
> The patch (generated with --ignore-all-space) below fixes it:
>
> --- c/lisp/progmodes/python.el
> +++ i/lisp/progmodes/python.el
> @@ -5135,7 +5135,8 @@ python-info-docstring-p
>               (>=
>                2
>                (let (last-backward-sexp-point)
> -                (while (save-excursion
> +                (while (and (<= counter 2)
> +                            (save-excursion

There wasn't any discussion of this patch, but it seems to fix the
problem and doesn't introduce any obvious regressions that I can see, so
I've applied it to Emacs 28.

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