Commit 05345bab authored by Noam Postavsky's avatar Noam Postavsky

Fix off by one error in python-mode assertion (Bug#30964)

* lisp/progmodes/python.el (python-nav-end-of-statement): Don't assert
that string-start is strictly greater than last-string-end, because
the string end is a position outside of the string and may therefore
be the same as the following string's start.
* test/lisp/progmodes/python-tests.el (python-nav-end-of-statement-2):
New test.
parent 92b609c5
......@@ -1518,7 +1518,7 @@ of the statement."
;; are somehow out of whack. This has been
;; observed when using `syntax-ppss' during
;; narrowing.
(cl-assert (> string-start last-string-end)
(cl-assert (>= string-start last-string-end)
:show-args
"\
Overlapping strings detected (start=%d, last-end=%d)")
......
......@@ -2004,6 +2004,12 @@ string
(python-util-forward-comment -1)
(point))))))
(ert-deftest python-nav-end-of-statement-2 ()
"Test the string overlap assertion (Bug#30964)."
(python-tests-with-temp-buffer
"'\n''\n"
(python-nav-end-of-statement)))
(ert-deftest python-nav-forward-statement-1 ()
(python-tests-with-temp-buffer
"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment