GNU bug report logs - #30964
python-mode failing "overlapping strings" assertion lately

Previous Next

Package: emacs;

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 #29 received at 30964 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Clément Pit-Claudel <clement.pitclaudel <at> live.com>
Cc: Philipp Stephani <p.stephani2 <at> gmail.com>, 30964 <at> debbugs.gnu.org,
 dancol <at> dancol.org
Subject: Re: bug#30964: python-mode failing "overlapping strings" assertion
 lately
Date: Tue, 29 May 2018 20:29:26 -0400
[Message part 1 (text/plain, inline)]
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:

[bug-30964-py-assert.py (text/x-python, inline)]
'
docstring''
[Message part 3 (text/plain, inline)]
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


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.