From: Noam Postavsky <npostavs@gmail.com>
To: Philipp Stephani <p.stephani2@gmail.com>
Cc: "Clément Pit-Claudel" <clement.pitclaudel@live.com>,
30964@debbugs.gnu.org
Subject: bug#30964: python-mode failing "overlapping strings" assertion lately
Date: Sat, 02 Jun 2018 16:35:50 -0400 [thread overview]
Message-ID: <87muwd9ba1.fsf@gmail.com> (raw)
In-Reply-To: <CAArVCkT=UKgki5xSf0wzcFZ0NNLSA0iOycKbwtXbWy7WyMTviA@mail.gmail.com> (Philipp Stephani's message of "Sat, 2 Jun 2018 21:03:10 +0200")
[-- Attachment #1: Type: text/plain, Size: 735 bytes --]
Philipp Stephani <p.stephani2@gmail.com> writes:
>> 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?
Yeah, the newlines are the important part it seems.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 2017 bytes --]
From 209506955227d3b4de030f817c087bf27e5a7426 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sat, 2 Jun 2018 16:22:17 -0400
Subject: [PATCH] Fix off by one error in python-mode assertion (Bug#30964)
* 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 | 2 +-
test/lisp/progmodes/python-tests.el | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index c7bb2d97c8..87d2f08fee 100644
--- a/lisp/progmodes/python.el
+++ b/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)
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el
index 4955da02a2..375bd9588d 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -2004,6 +2004,12 @@ python-tests-visible-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
"
--
2.11.0
next prev parent reply other threads:[~2018-06-02 20:35 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
2018-06-02 19:03 ` Philipp Stephani
2018-06-02 20:35 ` Noam Postavsky [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87muwd9ba1.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.