Subject: [PATCH] Fix regression from 296e4dd

From: Dario Gjorgjevski <[email-masked]>
Date: Wed, 11 Nov 2020 12:11:26 +0100

‘symbol-name’ should not be quantified by a ‘+’ as it is redundant and
performs very badly.

Sorry for the mishap!

>From e8b6bdff94a4c997eabc332b39a9d009762ae247 Mon Sep 17 00:00:00 2001
From: Dario Gjorgjevski <[email-masked]>
Date: Wed, 11 Nov 2020 12:07:04 +0100
Subject: [PATCH] Fix regression from 296e4dd
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

‘symbol-name’ should not be quantified by a ‘+’ as it is redundant and
performs very badly.
---
 lisp/progmodes/python.el | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index eb84b494e3..a179318589 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -662,14 +662,11 @@ python-font-lock-keywords-maximum-decoration
     ;; assignments
     ;; support for a = b = c = 5
     (,(lambda (limit)
-        (let ((re (python-rx (group (+ symbol-name))
-                             (? ?\[ (+ (not ?\])) ?\])
-                             (* space)
-                             ;; A type, like " : int ".
-                             (? ?:
-                                (* space)
-                                (+ not-simple-operator)
-                                (* space))
+        (let ((re (python-rx (group symbol-name)
+                             ;; subscript, like "[5]"
+                             (? ?\[ (+ (not ?\])) ?\]) (* space)
+                             ;; type hint, like ": int" or ": Mapping[int, str]"
+                             (? ?: (* space) (+ not-simple-operator) (* space))
                              assignment-operator))
               (res nil))
           (while (and (setq res (re-search-forward re limit t))
@@ -679,9 +676,9 @@ python-font-lock-keywords-maximum-decoration
      (1 font-lock-variable-name-face nil nil))
     ;; support for a, b, c = (1, 2, 3)
     (,(lambda (limit)
-        (let ((re (python-rx (group (+ symbol-name)) (* space)
-                             (* ?, (* space) (+ symbol-name) (* space))
-                             ?, (* space) (+ symbol-name) (* space)
+        (let ((re (python-rx (group symbol-name) (* space)
+                             (* ?, (* space) symbol-name (* space))
+                             ?, (* space) symbol-name (* space)
                              assignment-operator))
               (res nil))
           (while (and (setq res (re-search-forward re limit t))
-- 
2.28.0

Best regards,
Dario

-- 
$ keyserver=hkps://hkps.pool.sks-keyservers.net
$ keyid=744A4F0B4F1C9371
$ gpg --keyserver $keyserver --search-keys $keyid