bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#30964: python-mode failing "overlapping strings" assertion lately


From: Noam Postavsky
Subject: bug#30964: python-mode failing "overlapping strings" assertion lately
Date: Tue, 29 May 2018 20:29:26 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Clément Pit-Claudel <clement.pitclaudel@live.com> writes:

> Here's a reliable repro:
>
> def f():
>     "
>
> def g():
>     """That's a docstring"""
>     return ''

It can be reduced a bit:

'
docstring''
Debugger entered--Lisp error: (cl-assertion-failed ((> string-start 
last-string-end) "Overlapping strings detected" 13 13))
  cl--assertion-failed((> string-start last-string-end) "Overlapping strings 
detected" (13 13) nil)
  python-nav-end-of-statement()
  python-info-end-of-statement-p()
  python-info-end-of-block-p()
  python-nav--forward-sexp(-1 nil nil)
  python-nav-forward-sexp(-1 nil nil)
  python-nav-backward-sexp()
  python-info-docstring-p((0 nil nil t nil nil 0 nil 1 nil nil))
  python-font-lock-syntactic-face-function((0 nil nil t nil nil 0 nil 1 nil 
nil))
  font-lock-fontify-syntactically-region(1 15 nil)
  font-lock-default-fontify-region(1 15 nil)
  font-lock-fontify-region(1 15)
  font-lock-fontify-block(nil)
  funcall-interactively(font-lock-fontify-block nil)
  call-interactively(font-lock-fontify-block nil nil)
  command-execute(font-lock-fontify-block)

I think the problem is that the assertion is off by 1, it currently
asserts that there is at least one space between strings (because the
end position goes *after* the string, while the start position is part
of the string).

I see the assertion was added in [1: 4fbd330fae].  Phillip, does my
proposed change make sense to you?  ('make -C test python-tests' still
passes.)

--- i/lisp/progmodes/python.el
+++ w/lisp/progmodes/python.el
@@ -1506,7 +1506,7 @@ python-nav-end-of-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")
                        (goto-char string-start)

[1: 4fbd330fae]: 2017-03-23 23:05:19 +0100
  Protect against an infloop in python-mode
  
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=4fbd330fae54a9c45d4a717127aa86d75e9938d5


reply via email to

[Prev in Thread] Current Thread [Next in Thread]