From: Dario Gjorgjevski Date: Wed, 11 Nov 2020 11:27:59 +0000 (+0100) Subject: Fix python-font-lock-keywords-maximum-decoration performance regression X-Git-Tag: emacs-28.0.90~5186 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e7b4f465e8b2ec1c8d54a611db7eca44ae350711;p=emacs.git Fix python-font-lock-keywords-maximum-decoration performance regression * lisp/progmodes/python.el (python-font-lock-keywords-maximum-decoration): `symbol-name' should not be quantified by a `+' as it is redundant and performs very badly (bug#44572). --- diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index eb84b494e35..a1793185899 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -662,14 +662,11 @@ builtins.") ;; 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 @@ builtins.") (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))