Fix hangs caused by unbalanced braces in Python f-strings

* lisp/progmodes/python.el (python--font-lock-f-strings):
Temporarily bind forward-sexp-function to nil when calling
'up-list'.  (Bug#74738)
This commit is contained in:
kobarity 2024-12-15 23:02:51 +09:00 committed by Stefan Monnier
parent 75e3ea0423
commit 3c247f86b7

View file

@ -623,7 +623,8 @@ the {...} holes that appear within f-strings."
(forward-char 1) ;Just skip over {{
(let ((beg (match-beginning 0))
(end (condition-case nil
(let ((parse-sexp-ignore-comments))
(let ((forward-sexp-function)
(parse-sexp-ignore-comments))
(up-list 1)
(min send (point)))
(scan-error send))))