]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix off by one error in python-mode assertion (Bug#30964)
authorNoam Postavsky <npostavs@gmail.com>
Sat, 2 Jun 2018 20:22:17 +0000 (16:22 -0400)
committerNoam Postavsky <npostavs@gmail.com>
Sat, 16 Jun 2018 22:34:19 +0000 (18:34 -0400)
* 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.

lisp/progmodes/python.el
test/lisp/progmodes/python-tests.el

index 6f4a343310c5bfffb84784f4e081122cdb83ede4..e39ff08739b9c61178d50de65ba1ef288c066706 100644 (file)
@@ -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)")
index 1c4d22d72faf029600ed08333a482c7cc4211a48..0b9f8484c1013778232b64243954d3ba04623b4b 100644 (file)
@@ -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
    "