Subject: Re: bug#51362: python font-lock-mode in emacs 28 seems broken

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 11 Nov 2021 13:37:49 +0100

Dario Gjorgjevski <[email-masked]> writes:

> Would you be able to give it a try?

Or if it's easier in patch form:

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index b12b22e992..eebc9055bf 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -606,10 +606,11 @@ python-font-lock-assignment-matcher
 being treated as assignments) or is followed by an '=' sign (to
 avoid '==' being treated as an assignment."
   (lambda (limit)
-    (let ((res (re-search-forward regexp limit t)))
-      (unless (or (python-syntax-context 'paren)
-                  (equal (char-after (point)) ?=))
-        res))))
+    (let ((res nil))
+      (while (and (setq res (re-search-forward regexp limit t))
+                  (or (python-syntax-context 'paren)
+                      (equal (char-after (point)) ?=))))
+      res)))
 
 (defvar python-font-lock-keywords-maximum-decoration
   `((python--font-lock-f-strings)

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