1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Fix infloop in python-ts-mode string fontification (bug#79457)

* lisp/progmodes/python.el (python--treesit-fontify-string):
Make sure there's no infloop.
This commit is contained in:
Yuan Fu 2025-09-24 19:56:29 -07:00
parent 77921ce458
commit 202425f934
No known key found for this signature in database
GPG key ID: 56E19BC57664A442

View file

@ -1122,12 +1122,13 @@ fontified."
"body"))
(throw 'break 'font-lock-doc-face))
(let ((idx 0))
(while (< idx cursor-idx)
(unless (equal (treesit-node-type
(treesit-node-child parent idx))
"comment")
(throw 'break 'font-lock-string-face))))
;; If there's any non-comment sibling before
;; cursor, the string isn't a docstring.
(dotimes (idx cursor-idx)
(unless (equal (treesit-node-type
(treesit-node-child parent idx))
"comment")
(throw 'break 'font-lock-string-face)))
(setq cursor parent)))))
(ignore-interpolation
(not (seq-some