GNU bug report logs -
#30964
python-mode failing "overlapping strings" assertion lately
Previous Next
Reported by: dancol <at> dancol.org
Date: Tue, 27 Mar 2018 18:10:01 UTC
Severity: normal
Done: "Daniel Colascione" <dancol <at> dancol.org>
Bug is archived. No further changes may be made.
Full log
Message #32 received at 30964 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Noam Postavsky <npostavs <at> gmail.com> schrieb am Mi., 30. Mai 2018 um
02:29 Uhr:
> Clément Pit-Claudel <clement.pitclaudel <at> live.com> writes:
>
> > Here's a reliable repro:
> >
> > def f():
> > "
> >
> > def g():
> > """That's a docstring"""
> > return ''
>
> It can be reduced a bit:
>
>
> 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?
Maybe :-)
Off-by-one errors are always a bit subtle, so it might definitely be the
case that there is one. If so, the problem could be further reduced to
' '' '
or similar. Could you add a unit test using such input and make sure that
it breaks without your patch?
> ('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
>
>
[Message part 2 (text/html, inline)]
This bug report was last modified 6 years and 344 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.