aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorDario Gjorgjevski2020-11-11 12:27:59 +0100
committerLars Ingebrigtsen2020-11-11 12:27:59 +0100
commite7b4f465e8b2ec1c8d54a611db7eca44ae350711 (patch)
tree094a3e956cd9d53c3c611a96df69a806e9024dcb /lisp/progmodes/python.el
parentdaecf6d210c7e6b97ab239b24e3a335facc62891 (diff)
downloademacs-e7b4f465e8b2ec1c8d54a611db7eca44ae350711.tar.gz
emacs-e7b4f465e8b2ec1c8d54a611db7eca44ae350711.zip
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).
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el19
1 files changed, 8 insertions, 11 deletions
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.")
662 ;; assignments 662 ;; assignments
663 ;; support for a = b = c = 5 663 ;; support for a = b = c = 5
664 (,(lambda (limit) 664 (,(lambda (limit)
665 (let ((re (python-rx (group (+ symbol-name)) 665 (let ((re (python-rx (group symbol-name)
666 (? ?\[ (+ (not ?\])) ?\]) 666 ;; subscript, like "[5]"
667 (* space) 667 (? ?\[ (+ (not ?\])) ?\]) (* space)
668 ;; A type, like " : int ". 668 ;; type hint, like ": int" or ": Mapping[int, str]"
669 (? ?: 669 (? ?: (* space) (+ not-simple-operator) (* space))
670 (* space)
671 (+ not-simple-operator)
672 (* space))
673 assignment-operator)) 670 assignment-operator))
674 (res nil)) 671 (res nil))
675 (while (and (setq res (re-search-forward re limit t)) 672 (while (and (setq res (re-search-forward re limit t))
@@ -679,9 +676,9 @@ builtins.")
679 (1 font-lock-variable-name-face nil nil)) 676 (1 font-lock-variable-name-face nil nil))
680 ;; support for a, b, c = (1, 2, 3) 677 ;; support for a, b, c = (1, 2, 3)
681 (,(lambda (limit) 678 (,(lambda (limit)
682 (let ((re (python-rx (group (+ symbol-name)) (* space) 679 (let ((re (python-rx (group symbol-name) (* space)
683 (* ?, (* space) (+ symbol-name) (* space)) 680 (* ?, (* space) symbol-name (* space))
684 ?, (* space) (+ symbol-name) (* space) 681 ?, (* space) symbol-name (* space)
685 assignment-operator)) 682 assignment-operator))
686 (res nil)) 683 (res nil))
687 (while (and (setq res (re-search-forward re limit t)) 684 (while (and (setq res (re-search-forward re limit t))