From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.bugs Subject: bug#30964: python-mode failing "overlapping strings" assertion lately Date: Sat, 2 Jun 2018 21:03:10 +0200 Message-ID: References: <5c3e75f096fae419224804c590805b9c.squirrel@dancol.org> <874liqc7fd.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000bc3902056dad5a61" X-Trace: blaine.gmane.org 1527966127 27484 195.159.176.226 (2 Jun 2018 19:02:07 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 2 Jun 2018 19:02:07 +0000 (UTC) Cc: =?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel , 30964@debbugs.gnu.org To: Noam Postavsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jun 02 21:02:03 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 1fPBms-00073M-90 for geb-bug-gnu-emacs@m.gmane.org; Sat, 02 Jun 2018 21:02:02 +0200 Original-Received: from localhost ([::1]:60798 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPBoz-0003qd-AC for geb-bug-gnu-emacs@m.gmane.org; Sat, 02 Jun 2018 15:04:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54813) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPBot-0003qX-3Y for bug-gnu-emacs@gnu.org; Sat, 02 Jun 2018 15:04:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fPBoo-00029S-Kk for bug-gnu-emacs@gnu.org; Sat, 02 Jun 2018 15:04:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51668) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fPBoo-00028z-GW for bug-gnu-emacs@gnu.org; Sat, 02 Jun 2018 15:04:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fPBoo-0001uu-0O for bug-gnu-emacs@gnu.org; Sat, 02 Jun 2018 15:04:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philipp Stephani Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 02 Jun 2018 19:04:01 +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.15279662117321 (code B ref 30964); Sat, 02 Jun 2018 19:04:01 +0000 Original-Received: (at 30964) by debbugs.gnu.org; 2 Jun 2018 19:03:31 +0000 Original-Received: from localhost ([127.0.0.1]:59565 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fPBoJ-0001u0-Gg for submit@debbugs.gnu.org; Sat, 02 Jun 2018 15:03:31 -0400 Original-Received: from mail-ot0-f169.google.com ([74.125.82.169]:34938) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fPBoG-0001ti-AL for 30964@debbugs.gnu.org; Sat, 02 Jun 2018 15:03:29 -0400 Original-Received: by mail-ot0-f169.google.com with SMTP id q17-v6so22467796otg.2 for <30964@debbugs.gnu.org>; Sat, 02 Jun 2018 12:03:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YI+G1fpXwdd4haWxACkw5QsCDsAcw7emYWWSb8ZdWN4=; b=KGT225KAnJWohEFPutbnJa6HcPZcIeohtzTg8NUwi3x7tpXnSShF+NqXzb4i3wC4AO QwDsyp6Zcvm9AXTfe6BQRXQ9of8ovZKs5J1HWe26Dsb+oGAjieE5ILoaPxuCSWt2TMzc uFvKC1SWIfFX5UhMCWD4+/qRtTzx/wKIrAh/skK8LrfxVdoXK2Qe+03BK6NMiIwLkNQB 3XfsxOkb6gPQ92qQHHJcQkyJiTphq76twwq64UvUy0ZegjotEb/kZm97k4mwHrjKYOxa tjP9aL4JdohGV+rVaRFqruQEZssxnXGaaFfx3NJb3rqLVBIhtXU/wWDvsa8xBOYHMY+f Kg6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YI+G1fpXwdd4haWxACkw5QsCDsAcw7emYWWSb8ZdWN4=; b=TujdfMjCZciCPMvpvVNIIez/j3NhPgkMBTpKFDOr3DHvQWVHHAiY38zuZ1XI+o03VX 1nm6VWNj4+hX4r4uhFqAhwUiDEmswMgxETzysVb8fTbytbIP4UxKA89TOY+Vf4KUuwWz ttuMesRX7N9vYmXEgUW4P2/IEDSNQUX8axPXtzcXgryrrbAsIQDpk8niTYGLP5/JGCPa 2/NWeEKNzT5p1Hkzr2xu+cEIp9Khvw9ImqqJqkbNURdQhnRtK1cq8Npt/PODIkT+ujyt lFDT+HwxaL3rNuIRHcLICNmxjUwEyv62KZ9jEysOO8/20q2FE90pdBa5eNpernDgzY32 QMew== X-Gm-Message-State: APt69E1tjo8ZrhPj3VLl5GNbt+Ii1QgLuQwF0PX0rWQOdQIAvXeMk1bh TREmNjrQHI6X9dfxHJBE4opEGyeZnGDNCuh4Xk0= X-Google-Smtp-Source: ADUXVKIZniTCAWOXS6bAUOB0mZ+HZAPWltlZ8+h6O5hNbmdLVZurPdum1XoDc45DPaj8tkrieYqNlk+eH13rfV5zSe4= X-Received: by 2002:a9d:282e:: with SMTP id m43-v6mr10682962otb.393.1527966202606; Sat, 02 Jun 2018 12:03:22 -0700 (PDT) In-Reply-To: <874liqc7fd.fsf@gmail.com> 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:146875 Archived-At: --000000000000bc3902056dad5a61 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Noam Postavsky schrieb am Mi., 30. Mai 2018 um 02:29 Uhr: > Cl=C3=A9ment Pit-Claudel 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 (>=3D 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=3D4fbd330fae54a9c4= 5d4a717127aa86d75e9938d5 > > --000000000000bc3902056dad5a61 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


Noam P= ostavsky <npostavs@gmail.com&g= t; schrieb am Mi., 30. Mai 2018 um 02:29=C2=A0Uhr:
Cl=C3=A9ment Pit-Claudel <clement.pitclaudel@live.com> writ= es:

> Here's a reliable repro:
>
> def f():
>=C2=A0 =C2=A0 =C2=A0"
>
> def g():
>=C2=A0 =C2=A0 =C2=A0"""That's a docstring""= ;"
>=C2=A0 =C2=A0 =C2=A0return ''

It can be reduced a bit:


Debugger entered--Lisp error: (cl-assertion-failed ((> string-start last= -string-end) "Overlapping strings detected" 13 13))
=C2=A0 cl--assertion-failed((> string-start last-string-end) "Overl= apping strings detected" (13 13) nil)
=C2=A0 python-nav-end-of-statement()
=C2=A0 python-info-end-of-statement-p()
=C2=A0 python-info-end-of-block-p()
=C2=A0 python-nav--forward-sexp(-1 nil nil)
=C2=A0 python-nav-forward-sexp(-1 nil nil)
=C2=A0 python-nav-backward-sexp()
=C2=A0 python-info-docstring-p((0 nil nil t nil nil 0 nil 1 nil nil))
=C2=A0 python-font-lock-syntactic-face-function((0 nil nil t nil nil 0 nil = 1 nil nil))
=C2=A0 font-lock-fontify-syntactically-region(1 15 nil)
=C2=A0 font-lock-default-fontify-region(1 15 nil)
=C2=A0 font-lock-fontify-region(1 15)
=C2=A0 font-lock-fontify-block(nil)
=C2=A0 funcall-interactively(font-lock-fontify-block nil)
=C2=A0 call-interactively(font-lock-fontify-block nil nil)
=C2=A0 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].=C2=A0 Phillip, does my proposed change make sense to you?

Maybe :-= )
Off-by-one errors are always a bit subtle, so it might definite= ly be the case that there is one. If so, the problem could be further reduc= ed to
' '' '
or similar. Could you add = a unit test using such input and make sure that it breaks without your patc= h?

=C2=A0
=C2= =A0 ('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
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 ;; are somehow out of whack.=C2=A0 This has been
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 ;; observed when using `syntax-ppss' during
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 ;; narrowing.
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(cl-assert (> string-start last-string-end)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(cl-assert (>=3D string-start last-string-end)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0:show-args
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"Overlapping strin= gs detected")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 (goto-char string-start)

[1: 4fbd330fae]: 2017-03-23 23:05:19 +0100
=C2=A0 Protect against an infloop in python-mode
=C2=A0 https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=3D4fbd330fae54a9= c45d4a717127aa86d75e9938d5

--000000000000bc3902056dad5a61--