diff options
| author | Lars Ingebrigtsen | 2022-04-18 13:17:32 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2022-04-18 13:17:32 +0200 |
| commit | 85db21b94b23b4701930892d1eecc9a1167ed968 (patch) | |
| tree | 75cc7ac98d60477f5e822b75bef475084f51ba6f /lisp/progmodes/python.el | |
| parent | fac640ee8608748f0c4b867080d554c1b94121bd (diff) | |
| download | emacs-85db21b94b23b4701930892d1eecc9a1167ed968.tar.gz emacs-85db21b94b23b4701930892d1eecc9a1167ed968.zip | |
Avoid hangs in python-mode with debug-on-error set
* lisp/progmodes/python.el (python-nav-end-of-statement): Avoid
using cl-assert here, because this is called from the font-lock
machinery, and if debug-on-error is set here, we'll hang Emacs
(bug#54996).
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index f355055806c..b7914655aa8 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -1629,23 +1629,20 @@ of the statement." | |||
| 1629 | ;; are somehow out of whack. This has been | 1629 | ;; are somehow out of whack. This has been |
| 1630 | ;; observed when using `syntax-ppss' during | 1630 | ;; observed when using `syntax-ppss' during |
| 1631 | ;; narrowing. | 1631 | ;; narrowing. |
| 1632 | (cl-assert (>= string-start last-string-end) | 1632 | (when (>= string-start last-string-end) |
| 1633 | :show-args | 1633 | (goto-char string-start) |
| 1634 | "\ | 1634 | (if (python-syntax-context 'paren) |
| 1635 | Overlapping strings detected (start=%d, last-end=%d)") | 1635 | ;; Ended up inside a paren, roll again. |
| 1636 | (goto-char string-start) | 1636 | (python-nav-end-of-statement t) |
| 1637 | (if (python-syntax-context 'paren) | 1637 | ;; This is not inside a paren, move to the |
| 1638 | ;; Ended up inside a paren, roll again. | 1638 | ;; end of this string. |
| 1639 | (python-nav-end-of-statement t) | 1639 | (goto-char (+ (point) |
| 1640 | ;; This is not inside a paren, move to the | 1640 | (python-syntax-count-quotes |
| 1641 | ;; end of this string. | 1641 | (char-after (point)) (point)))) |
| 1642 | (goto-char (+ (point) | 1642 | (setq last-string-end |
| 1643 | (python-syntax-count-quotes | 1643 | (or (re-search-forward |
| 1644 | (char-after (point)) (point)))) | 1644 | (rx (syntax string-delimiter)) nil t) |
| 1645 | (setq last-string-end | 1645 | (goto-char (point-max))))))) |
| 1646 | (or (re-search-forward | ||
| 1647 | (rx (syntax string-delimiter)) nil t) | ||
| 1648 | (goto-char (point-max)))))) | ||
| 1649 | ((python-syntax-context 'paren) | 1646 | ((python-syntax-context 'paren) |
| 1650 | ;; The statement won't end before we've escaped | 1647 | ;; The statement won't end before we've escaped |
| 1651 | ;; at least one level of parenthesis. | 1648 | ;; at least one level of parenthesis. |