aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorYuan Fu2025-09-24 19:56:29 -0700
committerYuan Fu2025-09-24 19:59:05 -0700
commit202425f934a78aaee2bab294068dc86942a7c4d0 (patch)
tree31f0887a88399d745d9a0f35783fdb58921c52a0 /lisp/progmodes/python.el
parent77921ce458452312595696082379340802dc7bd4 (diff)
downloademacs-202425f934a78aaee2bab294068dc86942a7c4d0.tar.gz
emacs-202425f934a78aaee2bab294068dc86942a7c4d0.zip
Fix infloop in python-ts-mode string fontification (bug#79457)
* lisp/progmodes/python.el (python--treesit-fontify-string): Make sure there's no infloop.
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el13
1 files changed, 7 insertions, 6 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 22a4e2c2e5d..3f86c112265 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1122,12 +1122,13 @@ fontified."
1122 "body")) 1122 "body"))
1123 (throw 'break 'font-lock-doc-face)) 1123 (throw 'break 'font-lock-doc-face))
1124 1124
1125 (let ((idx 0)) 1125 ;; If there's any non-comment sibling before
1126 (while (< idx cursor-idx) 1126 ;; cursor, the string isn't a docstring.
1127 (unless (equal (treesit-node-type 1127 (dotimes (idx cursor-idx)
1128 (treesit-node-child parent idx)) 1128 (unless (equal (treesit-node-type
1129 "comment") 1129 (treesit-node-child parent idx))
1130 (throw 'break 'font-lock-string-face)))) 1130 "comment")
1131 (throw 'break 'font-lock-string-face)))
1131 (setq cursor parent))))) 1132 (setq cursor parent)))))
1132 (ignore-interpolation 1133 (ignore-interpolation
1133 (not (seq-some 1134 (not (seq-some