From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#30964: python-mode failing "overlapping strings" assertion lately Date: Sat, 02 Jun 2018 16:35:50 -0400 Message-ID: <87muwd9ba1.fsf@gmail.com> References: <5c3e75f096fae419224804c590805b9c.squirrel@dancol.org> <874liqc7fd.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1527971710 14821 195.159.176.226 (2 Jun 2018 20:35:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 2 Jun 2018 20:35:10 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Cc: =?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel , 30964@debbugs.gnu.org To: Philipp Stephani Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jun 02 22:35:06 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fPDEv-0003i8-CG for geb-bug-gnu-emacs@m.gmane.org; Sat, 02 Jun 2018 22:35:05 +0200 Original-Received: from localhost ([::1]:60972 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPDH0-0000qO-P3 for geb-bug-gnu-emacs@m.gmane.org; Sat, 02 Jun 2018 16:37:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPDGt-0000qI-Jt for bug-gnu-emacs@gnu.org; Sat, 02 Jun 2018 16:37:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fPDGo-0001Gx-MJ for bug-gnu-emacs@gnu.org; Sat, 02 Jun 2018 16:37:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51687) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fPDGo-0001Gr-F2 for bug-gnu-emacs@gnu.org; Sat, 02 Jun 2018 16:37:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fPDGo-0004jC-4y for bug-gnu-emacs@gnu.org; Sat, 02 Jun 2018 16:37:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 02 Jun 2018 20:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30964 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 30964-submit@debbugs.gnu.org id=B30964.152797176318097 (code B ref 30964); Sat, 02 Jun 2018 20:37:02 +0000 Original-Received: (at 30964) by debbugs.gnu.org; 2 Jun 2018 20:36:03 +0000 Original-Received: from localhost ([127.0.0.1]:59584 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fPDFr-0004hp-98 for submit@debbugs.gnu.org; Sat, 02 Jun 2018 16:36:03 -0400 Original-Received: from mail-io0-f175.google.com ([209.85.223.175]:43445) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fPDFo-0004hD-9S for 30964@debbugs.gnu.org; Sat, 02 Jun 2018 16:36:01 -0400 Original-Received: by mail-io0-f175.google.com with SMTP id t6-v6so15061675iob.10 for <30964@debbugs.gnu.org>; Sat, 02 Jun 2018 13:36:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=ozhTUMSM9pzABpCDoJxASRWgnnQon0Vr5ZHflkY5tA4=; b=bxVTz3o4B89WvKthCgCT7uEU+dSW4rd0clD+zLsyPlg9XIA0jJVg39S2/slTzDtl66 HVm+OnD0pRQylRc0uKjNjJQdWOn5OMJmXQFWliQa1XUAKFucRlK9z7Y+2NPLh0G7dBl8 StkeN3yBFxKOZWWpgEdvhw6rfhauhlsnELIlUC95MuDf1oGhAWaF+eDIn616hLU6eF8s poQJEVW2HU3UiDRZlTMaNpE/++iXo7cKb0+FZm2KDsFhsAkPkiKdrP3ckYinePTT0cU3 UtzpQFseOsj10dlwMhL0LCFvtA0BRzcxoYwrZU5l7jaCjINLidfIJX2IKSPYRaJvl9c/ MXRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=ozhTUMSM9pzABpCDoJxASRWgnnQon0Vr5ZHflkY5tA4=; b=hmwtEYyAvXzrxOt84s19bVrFls39Icbl8g5rFeNuds21KIw3xnCBbO89IcsxhTIbYd Jx34+cRBccNxPncjSOBMdCXZae/VCFpOxcDBpC1dCx5f2Z+Re1StwyKPjSJMng1qGG59 LzNruzF56UVQFh/YBOwH+D3WCnJ7sh3PA8vZRFK1mjU3yu0fjGUQBjECINGegZIiZsym FzM0A/hhQt1AxRwnuoxTLUZA1lTvlSNv5OeXzm+FZJXwRl90fn2b6VgUfYExZktZ7K/M i31aNnu8vRGmBP/A85jtsVv/++dUXhVT1gziRRGiqotU39cBU8xnQTaQjeqjZ8sq/w/Z PCvA== X-Gm-Message-State: APt69E2lFsASDO7YIafyTHMXLjxmMHq2tu7mVNNJ/Fu4w9f07HWOCZP+ nTATtuX0xh1ReRsG5L4TATk= X-Google-Smtp-Source: ADUXVKLqdU/9CAlxRNR8dMOkS1PqQ93ufTJCizCe2FWbc3aKaFOP1oy9ApK9OqNm5Z7yJePciqFHgA== X-Received: by 2002:a5e:9407:: with SMTP id q7-v6mr11380356ioj.268.1527971754803; Sat, 02 Jun 2018 13:35:54 -0700 (PDT) Original-Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id g6-v6sm2299359iti.0.2018.06.02.13.35.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 02 Jun 2018 13:35:53 -0700 (PDT) In-Reply-To: (Philipp Stephani's message of "Sat, 2 Jun 2018 21:03:10 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:146877 Archived-At: --=-=-= Content-Type: text/plain Philipp Stephani 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. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Fix-off-by-one-error-in-python-mode-assertion-Bug-30.patch Content-Description: patch >From 209506955227d3b4de030f817c087bf27e5a7426 Mon Sep 17 00:00:00 2001 From: Noam Postavsky 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 --=-=-=--