unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: "Clément Pit-Claudel" <clement.pitclaudel@live.com>
Cc: Philipp Stephani <p.stephani2@gmail.com>, 30964@debbugs.gnu.org
Subject: bug#30964: python-mode failing "overlapping strings" assertion lately
Date: Tue, 29 May 2018 20:29:26 -0400	[thread overview]
Message-ID: <874liqc7fd.fsf@gmail.com> (raw)
In-Reply-To: <e52a09f1-8c5d-a71e-74dd-e1ee43f579c3@live.com> ("Clément Pit-Claudel"'s message of "Fri, 18 May 2018 11:46:26 -0400")

[-- Attachment #1: Type: text/plain, Size: 208 bytes --]

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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: bug reproducer --]
[-- Type: text/x-python, Size: 14 bytes --]

'
docstring''

[-- Attachment #3: Type: text/plain, Size: 2034 bytes --]


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


  parent reply	other threads:[~2018-05-30  0:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-27 18:09 bug#30964: python-mode failing "overlapping strings" assertion lately dancol
2018-04-02  1:11 ` Noam Postavsky
2018-04-03 18:12 ` Charles A. Roelli
2018-04-03 22:06   ` Dmitry Gutov
2018-05-18 15:46 ` Clément Pit-Claudel
2018-05-18 19:18   ` Andreas Röhler
2018-05-19  1:49     ` Noam Postavsky
2018-05-19  6:49       ` Andreas Röhler
2018-05-30  0:29   ` Noam Postavsky [this message]
2018-06-02 19:03     ` Philipp Stephani
2018-06-02 20:35       ` Noam Postavsky
2018-06-16 20:55         ` Daniel Colascione
2018-06-16 22:36           ` Noam Postavsky
2018-06-17  7:33             ` Andreas Röhler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874liqc7fd.fsf@gmail.com \
    --to=npostavs@gmail.com \
    --cc=30964@debbugs.gnu.org \
    --cc=clement.pitclaudel@live.com \
    --cc=p.stephani2@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).