GNU bug report logs - #58780
python.el infinite loop in info-current-defun

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: JD Smith <jdtsmith@HIDDEN>; dated Tue, 25 Oct 2022 19:07:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 58780 <at> debbugs.gnu.org:


Received: (at 58780) by debbugs.gnu.org; 6 Dec 2022 01:41:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 05 20:41:06 2022
Received: from localhost ([127.0.0.1]:39581 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1p2MxF-00043J-Q7
	for submit <at> debbugs.gnu.org; Mon, 05 Dec 2022 20:41:06 -0500
Received: from relay2-d.mail.gandi.net ([217.70.183.194]:41543)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <pair@HIDDEN>) id 1p2I9D-0001Hq-Hb
 for 58780 <at> debbugs.gnu.org; Mon, 05 Dec 2022 15:33:08 -0500
Received: (Authenticated sender: public@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id B13E240008
 for <58780 <at> debbugs.gnu.org>; Mon,  5 Dec 2022 20:33:00 +0000 (UTC)
Received: by mail-ua1-f49.google.com with SMTP id e24so4303772uam.10
 for <58780 <at> debbugs.gnu.org>; Mon, 05 Dec 2022 12:33:00 -0800 (PST)
X-Gm-Message-State: ANoB5plV70s+9lqgEjibFhuIV1c+zphRW+XPBXZh2irT+GX4aJQtg3Lz
 Q86469m0C49wkTh50Hu7k8zjttIABiZnofY9UUo=
X-Google-Smtp-Source: AA0mqf5Gd7AdJM74VnJQ5C8QcaE5ksHgoYrRO5S0Vl+vhhuanCw0J1cA+R1XfSMo1qr1ZIQ2hpkDgyp3EeXX9vKgGsM=
X-Received: by 2002:ab0:238f:0:b0:411:968:212 with SMTP id
 b15-20020ab0238f000000b0041109680212mr51144038uan.107.1670272379293; 
 Mon, 05 Dec 2022 12:32:59 -0800 (PST)
MIME-Version: 1.0
References: <CA+caGh_ffNdN3MBmTdgW5HDHmUmqtBe=GXUXXOsThDQxcqtopQ@HIDDEN>
 <CA+caGh8UtFH9ZiCE6Vn6VHk0-vcfpxSMojZYMNbTxjeGYz6yag@HIDDEN>
 <CA+caGh-X3BY0jJc0bMCXT48S6xtst8Z30OtoJPkgty1s4xbkAQ@HIDDEN>
In-Reply-To: <CA+caGh-X3BY0jJc0bMCXT48S6xtst8Z30OtoJPkgty1s4xbkAQ@HIDDEN>
From: Ryan B <pair@HIDDEN>
Date: Mon, 5 Dec 2022 12:32:23 -0800
X-Gmail-Original-Message-ID: <CA+caGh_EKYywfzFB9ABkEeSwOCuqc0mYTuGQ_dL9gUY+N+jdJw@HIDDEN>
Message-ID: <CA+caGh_EKYywfzFB9ABkEeSwOCuqc0mYTuGQ_dL9gUY+N+jdJw@HIDDEN>
Subject: Re: python.el infinite loop in info-current-defun
To: 58780 <at> debbugs.gnu.org
Content-Type: multipart/alternative; boundary="000000000000d898ae05ef1a9730"
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 58780
X-Mailman-Approved-At: Mon, 05 Dec 2022 20:41:03 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--000000000000d898ae05ef1a9730
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Advice seems to work better at preventing the hang:

(defun python-nav-end-of-statement--bug-override (orig-fn &optional noend)
  (forward-line 1))
(advice-add 'python-nav-end-of-statement :around
#'python-nav-end-of-statement--bug-override)

On Mon, Dec 5, 2022 at 7:01 AM Ryan B <pair@HIDDEN> wrote:

> I take it back, that override doesn't fully prevent it after all. =F0=9F=
=98=A2
>
> On Mon, Dec 5, 2022 at 6:57 AM Ryan B <pair@HIDDEN> wrote:
>
>> Confirmed, probably the same root cause. When I brute force override
>> python-nav-end-of-statement like below, it doesn't happen any more.
>>
>> (defun python-nav-end-of-statement (&optional noend)
>>   (interactive "^")
>>   (forward-line 1))
>>
>>
>> On Mon, Dec 5, 2022 at 6:44 AM Ryan B <pair@HIDDEN> wrote:
>>
>>> I think I have a repro for this with a single quote ' , as opposed to
>>> triple string. I think I started seeing this hang after upgrading to Em=
acs
>>> 28.2. I now hit it very often, it's pretty painful. I don't know for su=
re
>>> that it's the same bug, but it seems likely. Reproduces with emacs -Q:
>>>
>>> =3D=3D=3D=3D=3D=3D
>>> class Foo():
>>>
>>>   def __init__(self):
>>>     '
>>>
>>>   def bar(self):
>>>     """Fetches posts and converts them to ActivityStreams activities.
>>>     See source.Source.get_activities_response for details. app_id is
>>>     ignored. min_id is translated to Twitter's since_id.
>>>     """
>>>     pass
>>> =3D=3D=3D=3D=3D=3D
>>>
>>> The single quote and multiple lines in the docstring are necessary for
>>> the repro. No extra newline at the end needed though.
>>>
>>> JD, do you have a workaround for this? I may look into overriding
>>> python-nav-end-of-defun until it's fixed. Any other ideas?
>>>
>>> My emacs-version: GNU Emacs 28.2 (build 1, aarch64-apple-darwin21.1.0,
>>> NS appkit-2113.00 Version 12.0.1 (Build 21A559)) of 2022-09-12
>>>
>>> --
>>> https://snarfed.org/
>>>
>>
>>
>> --
>> https://snarfed.org/
>>
>
>
> --
> https://snarfed.org/
>


--=20
https://snarfed.org/

--000000000000d898ae05ef1a9730
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Advice seems to work better at preventing the hang:</=
div><div><br></div><div>(defun python-nav-end-of-statement--bug-override (o=
rig-fn &amp;optional noend)<br>=C2=A0 (forward-line 1))<br>(advice-add &#39=
;python-nav-end-of-statement :around #&#39;python-nav-end-of-statement--bug=
-override)<br></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" c=
lass=3D"gmail_attr">On Mon, Dec 5, 2022 at 7:01 AM Ryan B &lt;<a href=3D"ma=
ilto:pair@HIDDEN">pair@HIDDEN</a>&gt; wrote:<br></div><blockquote cla=
ss=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid =
rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">I take it back, that ov=
erride doesn&#39;t fully prevent it after all. =F0=9F=98=A2<br></div><br><d=
iv class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Dec =
5, 2022 at 6:57 AM Ryan B &lt;<a href=3D"mailto:pair@HIDDEN" target=3D"_=
blank">pair@HIDDEN</a>&gt; wrote:<br></div><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,20=
4);padding-left:1ex"><div dir=3D"ltr"><div>Confirmed, probably the same roo=
t cause. When I brute force override python-nav-end-of-statement like below=
, it doesn&#39;t happen any more.<br></div><div><br></div><div>(defun pytho=
n-nav-end-of-statement (&amp;optional noend)<br>=C2=A0 (interactive &quot;^=
&quot;)<br>=C2=A0 (forward-line 1))<br></div><div><br></div></div><br><div =
class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Dec 5, =
2022 at 6:44 AM Ryan B &lt;<a href=3D"mailto:pair@HIDDEN" target=3D"_bla=
nk">pair@HIDDEN</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote=
" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);=
padding-left:1ex"><div dir=3D"ltr"><div>I think I have a repro for this wit=
h a single quote &#39; , as opposed to triple string. I think I started see=
ing this hang after upgrading to Emacs 28.2. I now hit it very often, it&#3=
9;s pretty painful. I don&#39;t know for sure that it&#39;s the same bug, b=
ut it seems likely. Reproduces with emacs -Q:<br></div><div><br></div><div>=
=3D=3D=3D=3D=3D=3D<br></div><div>class Foo():<br><br>=C2=A0 def __init__(se=
lf):<br>=C2=A0 =C2=A0 &#39;<br><br>=C2=A0 def bar(self):<br>=C2=A0 =C2=A0 &=
quot;&quot;&quot;Fetches posts and converts them to ActivityStreams activit=
ies.<br>=C2=A0 =C2=A0 See source.Source.get_activities_response for details=
. app_id is<br>=C2=A0 =C2=A0 ignored. min_id is translated to Twitter&#39;s=
 since_id.<br>=C2=A0 =C2=A0 &quot;&quot;&quot;<br>=C2=A0 =C2=A0 pass<br></d=
iv><div>=3D=3D=3D=3D=3D=3D</div><div><br></div><div>The single quote and mu=
ltiple lines in the docstring are necessary for the repro. No extra newline=
 at the end needed though.</div><br><div>JD, do you have a workaround for t=
his? I may look into overriding python-nav-end-of-defun until it&#39;s fixe=
d. Any other ideas?<br></div><div><div><br></div><div>My emacs-version: GNU=
 Emacs 28.2 (build 1,=20
aarch64-apple-darwin21.1.0, NS appkit-2113.00 Version 12.0.1 (Build=20
21A559)) of 2022-09-12<br><br></div></div><div>-- <br><div dir=3D"ltr"><a h=
ref=3D"https://snarfed.org/" target=3D"_blank">https://snarfed.org/</a></di=
v></div></div>
</blockquote></div><br clear=3D"all"><br>-- <br><div dir=3D"ltr"><a href=3D=
"https://snarfed.org/" target=3D"_blank">https://snarfed.org/</a></div>
</blockquote></div><br clear=3D"all"><br>-- <br><div dir=3D"ltr"><a href=3D=
"https://snarfed.org/" target=3D"_blank">https://snarfed.org/</a></div>
</blockquote></div><br clear=3D"all"><br>-- <br><div dir=3D"ltr" class=3D"g=
mail_signature"><a href=3D"https://snarfed.org/" target=3D"_blank">https://=
snarfed.org/</a></div>

--000000000000d898ae05ef1a9730--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#58780; Package emacs. Full text available.

Message received at 58780 <at> debbugs.gnu.org:


Received: (at 58780) by debbugs.gnu.org; 6 Dec 2022 01:40:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 05 20:40:53 2022
Received: from localhost ([127.0.0.1]:39574 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1p2Mx2-000424-To
	for submit <at> debbugs.gnu.org; Mon, 05 Dec 2022 20:40:53 -0500
Received: from relay7-d.mail.gandi.net ([217.70.183.200]:44869)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <pair@HIDDEN>) id 1p2Cyp-00049l-2A
 for 58780 <at> debbugs.gnu.org; Mon, 05 Dec 2022 10:02:04 -0500
Received: (Authenticated sender: public@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id D26B22000D
 for <58780 <at> debbugs.gnu.org>; Mon,  5 Dec 2022 15:01:56 +0000 (UTC)
Received: by mail-vs1-f48.google.com with SMTP id c184so11327236vsc.3
 for <58780 <at> debbugs.gnu.org>; Mon, 05 Dec 2022 07:01:56 -0800 (PST)
X-Gm-Message-State: ANoB5pncv0MPA5LJpt337M0PCVBHXMknW1WJOEa/T7+ccTreG2wOjPLD
 yW2h+TxnlPce9E05byIDuexGKKAxRNgl5EyiD10=
X-Google-Smtp-Source: AA0mqf7NevZ3ym72riFl5MRji2ys6WFAHDl0Eu3RXeAUtytMZVT12he8neiQtzrLrHdc0N3cVF0pw8uxW1Qs3vCUl0k=
X-Received: by 2002:a67:f8d4:0:b0:3aa:1a3a:6447 with SMTP id
 c20-20020a67f8d4000000b003aa1a3a6447mr36054359vsp.50.1670252515255; Mon, 05
 Dec 2022 07:01:55 -0800 (PST)
MIME-Version: 1.0
References: <CA+caGh_ffNdN3MBmTdgW5HDHmUmqtBe=GXUXXOsThDQxcqtopQ@HIDDEN>
 <CA+caGh8UtFH9ZiCE6Vn6VHk0-vcfpxSMojZYMNbTxjeGYz6yag@HIDDEN>
In-Reply-To: <CA+caGh8UtFH9ZiCE6Vn6VHk0-vcfpxSMojZYMNbTxjeGYz6yag@HIDDEN>
From: Ryan B <pair@HIDDEN>
Date: Mon, 5 Dec 2022 07:01:19 -0800
X-Gmail-Original-Message-ID: <CA+caGh-X3BY0jJc0bMCXT48S6xtst8Z30OtoJPkgty1s4xbkAQ@HIDDEN>
Message-ID: <CA+caGh-X3BY0jJc0bMCXT48S6xtst8Z30OtoJPkgty1s4xbkAQ@HIDDEN>
Subject: Re: python.el infinite loop in info-current-defun
To: 58780 <at> debbugs.gnu.org
Content-Type: multipart/alternative; boundary="000000000000db6b7e05ef15f78c"
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 58780
X-Mailman-Approved-At: Mon, 05 Dec 2022 20:40:52 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--000000000000db6b7e05ef15f78c
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

I take it back, that override doesn't fully prevent it after all. =F0=9F=98=
=A2

On Mon, Dec 5, 2022 at 6:57 AM Ryan B <pair@HIDDEN> wrote:

> Confirmed, probably the same root cause. When I brute force override
> python-nav-end-of-statement like below, it doesn't happen any more.
>
> (defun python-nav-end-of-statement (&optional noend)
>   (interactive "^")
>   (forward-line 1))
>
>
> On Mon, Dec 5, 2022 at 6:44 AM Ryan B <pair@HIDDEN> wrote:
>
>> I think I have a repro for this with a single quote ' , as opposed to
>> triple string. I think I started seeing this hang after upgrading to Ema=
cs
>> 28.2. I now hit it very often, it's pretty painful. I don't know for sur=
e
>> that it's the same bug, but it seems likely. Reproduces with emacs -Q:
>>
>> =3D=3D=3D=3D=3D=3D
>> class Foo():
>>
>>   def __init__(self):
>>     '
>>
>>   def bar(self):
>>     """Fetches posts and converts them to ActivityStreams activities.
>>     See source.Source.get_activities_response for details. app_id is
>>     ignored. min_id is translated to Twitter's since_id.
>>     """
>>     pass
>> =3D=3D=3D=3D=3D=3D
>>
>> The single quote and multiple lines in the docstring are necessary for
>> the repro. No extra newline at the end needed though.
>>
>> JD, do you have a workaround for this? I may look into overriding
>> python-nav-end-of-defun until it's fixed. Any other ideas?
>>
>> My emacs-version: GNU Emacs 28.2 (build 1, aarch64-apple-darwin21.1.0, N=
S
>> appkit-2113.00 Version 12.0.1 (Build 21A559)) of 2022-09-12
>>
>> --
>> https://snarfed.org/
>>
>
>
> --
> https://snarfed.org/
>


--=20
https://snarfed.org/

--000000000000db6b7e05ef15f78c
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I take it back, that override doesn&#39;t fully prevent it=
 after all. =F0=9F=98=A2<br></div><br><div class=3D"gmail_quote"><div dir=
=3D"ltr" class=3D"gmail_attr">On Mon, Dec 5, 2022 at 6:57 AM Ryan B &lt;<a =
href=3D"mailto:pair@HIDDEN">pair@HIDDEN</a>&gt; wrote:<br></div><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:=
1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div>Confirme=
d, probably the same root cause. When I brute force override python-nav-end=
-of-statement like below, it doesn&#39;t happen any more.<br></div><div><br=
></div><div>(defun python-nav-end-of-statement (&amp;optional noend)<br>=C2=
=A0 (interactive &quot;^&quot;)<br>=C2=A0 (forward-line 1))<br></div><div><=
br></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gma=
il_attr">On Mon, Dec 5, 2022 at 6:44 AM Ryan B &lt;<a href=3D"mailto:pair@r=
yanb.org" target=3D"_blank">pair@HIDDEN</a>&gt; wrote:<br></div><blockqu=
ote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px=
 solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div>I think I h=
ave a repro for this with a single quote &#39; , as opposed to triple strin=
g. I think I started seeing this hang after upgrading to Emacs 28.2. I now =
hit it very often, it&#39;s pretty painful. I don&#39;t know for sure that =
it&#39;s the same bug, but it seems likely. Reproduces with emacs -Q:<br></=
div><div><br></div><div>=3D=3D=3D=3D=3D=3D<br></div><div>class Foo():<br><b=
r>=C2=A0 def __init__(self):<br>=C2=A0 =C2=A0 &#39;<br><br>=C2=A0 def bar(s=
elf):<br>=C2=A0 =C2=A0 &quot;&quot;&quot;Fetches posts and converts them to=
 ActivityStreams activities.<br>=C2=A0 =C2=A0 See source.Source.get_activit=
ies_response for details. app_id is<br>=C2=A0 =C2=A0 ignored. min_id is tra=
nslated to Twitter&#39;s since_id.<br>=C2=A0 =C2=A0 &quot;&quot;&quot;<br>=
=C2=A0 =C2=A0 pass<br></div><div>=3D=3D=3D=3D=3D=3D</div><div><br></div><di=
v>The single quote and multiple lines in the docstring are necessary for th=
e repro. No extra newline at the end needed though.</div><br><div>JD, do yo=
u have a workaround for this? I may look into overriding python-nav-end-of-=
defun until it&#39;s fixed. Any other ideas?<br></div><div><div><br></div><=
div>My emacs-version: GNU Emacs 28.2 (build 1,=20
aarch64-apple-darwin21.1.0, NS appkit-2113.00 Version 12.0.1 (Build=20
21A559)) of 2022-09-12<br><br></div></div><div>-- <br><div dir=3D"ltr"><a h=
ref=3D"https://snarfed.org/" target=3D"_blank">https://snarfed.org/</a></di=
v></div></div>
</blockquote></div><br clear=3D"all"><br>-- <br><div dir=3D"ltr"><a href=3D=
"https://snarfed.org/" target=3D"_blank">https://snarfed.org/</a></div>
</blockquote></div><br clear=3D"all"><br>-- <br><div dir=3D"ltr" class=3D"g=
mail_signature"><a href=3D"https://snarfed.org/" target=3D"_blank">https://=
snarfed.org/</a></div>

--000000000000db6b7e05ef15f78c--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#58780; Package emacs. Full text available.

Message received at 58780 <at> debbugs.gnu.org:


Received: (at 58780) by debbugs.gnu.org; 6 Dec 2022 01:40:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 05 20:40:43 2022
Received: from localhost ([127.0.0.1]:39571 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1p2Mws-00041v-VF
	for submit <at> debbugs.gnu.org; Mon, 05 Dec 2022 20:40:43 -0500
Received: from relay5-d.mail.gandi.net ([217.70.183.197]:37239)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <pair@HIDDEN>) id 1p2CvB-00045q-OY
 for 58780 <at> debbugs.gnu.org; Mon, 05 Dec 2022 09:58:18 -0500
Received: (Authenticated sender: public@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id B7EFC1C0007
 for <58780 <at> debbugs.gnu.org>; Mon,  5 Dec 2022 14:58:08 +0000 (UTC)
Received: by mail-vs1-f53.google.com with SMTP id b189so5408683vsc.10
 for <58780 <at> debbugs.gnu.org>; Mon, 05 Dec 2022 06:58:08 -0800 (PST)
X-Gm-Message-State: ANoB5pl8uy51EAj0+0kPJrrFxM6VhR94Yp7kk7iOHWgWoief/waixFgw
 /bEruwtz8VxwdhrfgGxPH1ORKHiFGs3wUaULn54=
X-Google-Smtp-Source: AA0mqf7u1zjcVDE/Ezmsdj6HZcfiOEGuXq+7+pG6LBajMbIushsKqnoGcLO+strQcsRmL1gwZf0PvQCD7lrDI8dXp1Y=
X-Received: by 2002:a67:f8d4:0:b0:3aa:1a3a:6447 with SMTP id
 c20-20020a67f8d4000000b003aa1a3a6447mr36039103vsp.50.1670252287308; Mon, 05
 Dec 2022 06:58:07 -0800 (PST)
MIME-Version: 1.0
References: <CA+caGh_ffNdN3MBmTdgW5HDHmUmqtBe=GXUXXOsThDQxcqtopQ@HIDDEN>
In-Reply-To: <CA+caGh_ffNdN3MBmTdgW5HDHmUmqtBe=GXUXXOsThDQxcqtopQ@HIDDEN>
From: Ryan B <pair@HIDDEN>
Date: Mon, 5 Dec 2022 06:57:31 -0800
X-Gmail-Original-Message-ID: <CA+caGh8UtFH9ZiCE6Vn6VHk0-vcfpxSMojZYMNbTxjeGYz6yag@HIDDEN>
Message-ID: <CA+caGh8UtFH9ZiCE6Vn6VHk0-vcfpxSMojZYMNbTxjeGYz6yag@HIDDEN>
Subject: Re: python.el infinite loop in info-current-defun
To: 58780 <at> debbugs.gnu.org
Content-Type: multipart/alternative; boundary="000000000000453d8b05ef15ea4a"
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 58780
X-Mailman-Approved-At: Mon, 05 Dec 2022 20:40:42 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--000000000000453d8b05ef15ea4a
Content-Type: text/plain; charset="UTF-8"

Confirmed, probably the same root cause. When I brute force override
python-nav-end-of-statement like below, it doesn't happen any more.

(defun python-nav-end-of-statement (&optional noend)
  (interactive "^")
  (forward-line 1))


On Mon, Dec 5, 2022 at 6:44 AM Ryan B <pair@HIDDEN> wrote:

> I think I have a repro for this with a single quote ' , as opposed to
> triple string. I think I started seeing this hang after upgrading to Emacs
> 28.2. I now hit it very often, it's pretty painful. I don't know for sure
> that it's the same bug, but it seems likely. Reproduces with emacs -Q:
>
> ======
> class Foo():
>
>   def __init__(self):
>     '
>
>   def bar(self):
>     """Fetches posts and converts them to ActivityStreams activities.
>     See source.Source.get_activities_response for details. app_id is
>     ignored. min_id is translated to Twitter's since_id.
>     """
>     pass
> ======
>
> The single quote and multiple lines in the docstring are necessary for the
> repro. No extra newline at the end needed though.
>
> JD, do you have a workaround for this? I may look into overriding
> python-nav-end-of-defun until it's fixed. Any other ideas?
>
> My emacs-version: GNU Emacs 28.2 (build 1, aarch64-apple-darwin21.1.0, NS
> appkit-2113.00 Version 12.0.1 (Build 21A559)) of 2022-09-12
>
> --
> https://snarfed.org/
>


-- 
https://snarfed.org/

--000000000000453d8b05ef15ea4a
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Confirmed, probably the same root cause. When I brute=
 force override python-nav-end-of-statement like below, it doesn&#39;t happ=
en any more.<br></div><div><br></div><div>(defun python-nav-end-of-statemen=
t (&amp;optional noend)<br>=C2=A0 (interactive &quot;^&quot;)<br>=C2=A0 (fo=
rward-line 1))<br></div><div><br></div></div><br><div class=3D"gmail_quote"=
><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Dec 5, 2022 at 6:44 AM Ryan =
B &lt;<a href=3D"mailto:pair@HIDDEN">pair@HIDDEN</a>&gt; wrote:<br></=
div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bor=
der-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div=
>I think I have a repro for this with a single quote &#39; , as opposed to =
triple string. I think I started seeing this hang after upgrading to Emacs =
28.2. I now hit it very often, it&#39;s pretty painful. I don&#39;t know fo=
r sure that it&#39;s the same bug, but it seems likely. Reproduces with ema=
cs -Q:<br></div><div><br></div><div>=3D=3D=3D=3D=3D=3D<br></div><div>class =
Foo():<br><br>=C2=A0 def __init__(self):<br>=C2=A0 =C2=A0 &#39;<br><br>=C2=
=A0 def bar(self):<br>=C2=A0 =C2=A0 &quot;&quot;&quot;Fetches posts and con=
verts them to ActivityStreams activities.<br>=C2=A0 =C2=A0 See source.Sourc=
e.get_activities_response for details. app_id is<br>=C2=A0 =C2=A0 ignored. =
min_id is translated to Twitter&#39;s since_id.<br>=C2=A0 =C2=A0 &quot;&quo=
t;&quot;<br>=C2=A0 =C2=A0 pass<br></div><div>=3D=3D=3D=3D=3D=3D</div><div><=
br></div><div>The single quote and multiple lines in the docstring are nece=
ssary for the repro. No extra newline at the end needed though.</div><br><d=
iv>JD, do you have a workaround for this? I may look into overriding python=
-nav-end-of-defun until it&#39;s fixed. Any other ideas?<br></div><div><div=
><br></div><div>My emacs-version: GNU Emacs 28.2 (build 1,=20
aarch64-apple-darwin21.1.0, NS appkit-2113.00 Version 12.0.1 (Build=20
21A559)) of 2022-09-12<br><br></div></div><div>-- <br><div dir=3D"ltr"><a h=
ref=3D"https://snarfed.org/" target=3D"_blank">https://snarfed.org/</a></di=
v></div></div>
</blockquote></div><br clear=3D"all"><br>-- <br><div dir=3D"ltr" class=3D"g=
mail_signature"><a href=3D"https://snarfed.org/" target=3D"_blank">https://=
snarfed.org/</a></div>

--000000000000453d8b05ef15ea4a--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#58780; Package emacs. Full text available.

Message received at 58780 <at> debbugs.gnu.org:


Received: (at 58780) by debbugs.gnu.org; 6 Dec 2022 01:39:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 05 20:39:39 2022
Received: from localhost ([127.0.0.1]:39558 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1p2Mvq-00040U-Dt
	for submit <at> debbugs.gnu.org; Mon, 05 Dec 2022 20:39:39 -0500
Received: from relay3-d.mail.gandi.net ([217.70.183.195]:50803)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <pair@HIDDEN>) id 1p2Civ-0003tL-8I
 for 58780 <at> debbugs.gnu.org; Mon, 05 Dec 2022 09:45:38 -0500
Received: (Authenticated sender: public@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id B9E3960009
 for <58780 <at> debbugs.gnu.org>; Mon,  5 Dec 2022 14:45:30 +0000 (UTC)
Received: by mail-vs1-f45.google.com with SMTP id 3so10405797vsq.7
 for <58780 <at> debbugs.gnu.org>; Mon, 05 Dec 2022 06:45:30 -0800 (PST)
X-Gm-Message-State: ANoB5plPfYE4aM92z28+9R+bXDHIFrAqxTdh9HRTqX+o7WrJhgnm4oYW
 amFEm+2Js1ofcCiDOTy40yJic/O8xWd7igpxJNM=
X-Google-Smtp-Source: AA0mqf7tx4YjJT++ms6GxvvLAYsKiRAtP2tIhABrzH6OZhFtLoNnWLmMpLKykAgbzQI9qu5meAah4qJAPeoHmbDoeXw=
X-Received: by 2002:a67:eec3:0:b0:3ac:4693:4d66 with SMTP id
 o3-20020a67eec3000000b003ac46934d66mr41340067vsp.44.1670251529244; Mon, 05
 Dec 2022 06:45:29 -0800 (PST)
MIME-Version: 1.0
From: Ryan B <pair@HIDDEN>
Date: Mon, 5 Dec 2022 06:44:53 -0800
X-Gmail-Original-Message-ID: <CA+caGh_ffNdN3MBmTdgW5HDHmUmqtBe=GXUXXOsThDQxcqtopQ@HIDDEN>
Message-ID: <CA+caGh_ffNdN3MBmTdgW5HDHmUmqtBe=GXUXXOsThDQxcqtopQ@HIDDEN>
Subject: python.el infinite loop in info-current-defun
To: 58780 <at> debbugs.gnu.org
Content-Type: multipart/alternative; boundary="000000000000161bdc05ef15bd5b"
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 58780
X-Mailman-Approved-At: Mon, 05 Dec 2022 20:39:37 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--000000000000161bdc05ef15bd5b
Content-Type: text/plain; charset="UTF-8"

I think I have a repro for this with a single quote ' , as opposed to
triple string. I think I started seeing this hang after upgrading to Emacs
28.2. I now hit it very often, it's pretty painful. I don't know for sure
that it's the same bug, but it seems likely. Reproduces with emacs -Q:

======
class Foo():

  def __init__(self):
    '

  def bar(self):
    """Fetches posts and converts them to ActivityStreams activities.
    See source.Source.get_activities_response for details. app_id is
    ignored. min_id is translated to Twitter's since_id.
    """
    pass
======

The single quote and multiple lines in the docstring are necessary for the
repro. No extra newline at the end needed though.

JD, do you have a workaround for this? I may look into overriding
python-nav-end-of-defun until it's fixed. Any other ideas?

My emacs-version: GNU Emacs 28.2 (build 1, aarch64-apple-darwin21.1.0, NS
appkit-2113.00 Version 12.0.1 (Build 21A559)) of 2022-09-12

-- 
https://snarfed.org/

--000000000000161bdc05ef15bd5b
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>I think I have a repro for this with a single quote &=
#39; , as opposed to triple string. I think I started seeing this hang afte=
r upgrading to Emacs 28.2. I now hit it very often, it&#39;s pretty painful=
. I don&#39;t know for sure that it&#39;s the same bug, but it seems likely=
. Reproduces with emacs -Q:<br></div><div><br></div><div>=3D=3D=3D=3D=3D=3D=
<br></div><div>class Foo():<br><br>=C2=A0 def __init__(self):<br>=C2=A0 =C2=
=A0 &#39;<br><br>=C2=A0 def bar(self):<br>=C2=A0 =C2=A0 &quot;&quot;&quot;F=
etches posts and converts them to ActivityStreams activities.<br>=C2=A0 =C2=
=A0 See source.Source.get_activities_response for details. app_id is<br>=C2=
=A0 =C2=A0 ignored. min_id is translated to Twitter&#39;s since_id.<br>=C2=
=A0 =C2=A0 &quot;&quot;&quot;<br>=C2=A0 =C2=A0 pass<br></div><div>=3D=3D=3D=
=3D=3D=3D</div><div><br></div><div>The single quote and multiple lines in t=
he docstring are necessary for the repro. No extra newline at the end neede=
d though.</div><br><div>JD, do you have a workaround for this? I may look i=
nto overriding python-nav-end-of-defun until it&#39;s fixed. Any other idea=
s?<br></div><div><div><br></div><div>My emacs-version: GNU Emacs 28.2 (buil=
d 1,=20
aarch64-apple-darwin21.1.0, NS appkit-2113.00 Version 12.0.1 (Build=20
21A559)) of 2022-09-12<br><br></div></div><div>-- <br><div dir=3D"ltr" clas=
s=3D"gmail_signature" data-smartmail=3D"gmail_signature"><a href=3D"https:/=
/snarfed.org/" target=3D"_blank">https://snarfed.org/</a></div></div></div>

--000000000000161bdc05ef15bd5b--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#58780; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 25 Oct 2022 19:06:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 25 15:06:44 2022
Received: from localhost ([127.0.0.1]:52291 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1onPG8-0003Wh-59
	for submit <at> debbugs.gnu.org; Tue, 25 Oct 2022 15:06:44 -0400
Received: from lists.gnu.org ([209.51.188.17]:38572)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jdtsmith@HIDDEN>) id 1onPG6-0003WZ-Ch
 for submit <at> debbugs.gnu.org; Tue, 25 Oct 2022 15:06:42 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <jdtsmith@HIDDEN>)
 id 1onPG6-0005e2-7H
 for bug-gnu-emacs@HIDDEN; Tue, 25 Oct 2022 15:06:42 -0400
Received: from mail-io1-xd33.google.com ([2607:f8b0:4864:20::d33])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <jdtsmith@HIDDEN>)
 id 1onPG4-0007Jz-EU
 for bug-gnu-emacs@HIDDEN; Tue, 25 Oct 2022 15:06:41 -0400
Received: by mail-io1-xd33.google.com with SMTP id 63so1650107iov.8
 for <bug-gnu-emacs@HIDDEN>; Tue, 25 Oct 2022 12:06:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=to:date:message-id:subject:mime-version:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=1Uznq9hhn5jAijhxpl03D9IN5cHnAV/glCsAqBc5RiY=;
 b=jTkqS8gcUz3r7tXVC48K5yIPD+mG4MRXJv7bek2NrBn0e7sKY9Kf+WAI1Vcdgyc2zY
 eYgmWNDGpK99ygrpRUXTLNyb7T7TRvZSw0vqJxhzHRyRVgLEC22tYIAc/+4FUBgyzt7n
 ZVvPFB17CuW3f93IebwybI5eZLRKvR7jGqULmVZt1KOH4T8RFqm7ElZz125JkMlJ7hb7
 nzGcU+0+KtQYQXT9+emE93LPPf0wcyKGzjCg/1/wQ3mfLhU7mZlf3XRA6tOsQEQh42pi
 rayZN4v+WtZvhS+5oPsxgIO7gwo8sTkiyR7K6Kf4JuLifrTbhPBVCcCnx2XUdbypKDUJ
 wLOA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=to:date:message-id:subject:mime-version:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=1Uznq9hhn5jAijhxpl03D9IN5cHnAV/glCsAqBc5RiY=;
 b=BsTljfIJQOAKqniyCb7T9wlfX9iOTDIA2wyi/InA+ELaeRjebml/ID4YThFjagv098
 +4XVmDqTr2F7hEDynpOJXSZRXbibE7YicIRbkmsDe//k+V+EE+6kP2NT/khSKlKSaDXR
 0c1adxuIy/FmAJMyylS//U7uJvdTUabXTHpoGVLciYFCwTYL/XXCgRVOiQpm4Wucz4tV
 1vXN+cYVIfuONvBaSj/GtMByFTcVkY4bURL6Xy/JSItQR0hVRkNHO9qORZIvNeTbwOsw
 Rt25oEIYwygXnCw5n7gAwhY4ZzpMBx2a5+ixBX555wOI7lMOm+13n/xyDGiVm/LgkHkc
 pcQA==
X-Gm-Message-State: ACrzQf2zp22VJeDchVAaE1O5nggWxo+xHZ6JKa9mnyNSEDgjTblNYidm
 O+wiKQWFRztSuj0Dmvw4zM38Fb4b4Hw=
X-Google-Smtp-Source: AMsMyM764Jrgc9qlXrb7wI6q70th79fzc6EmZrmDGxOPhE6X7LrLOtCJKYHqqHcpr0o2eRPY4TIwHQ==
X-Received: by 2002:a02:8804:0:b0:35b:7425:82af with SMTP id
 r4-20020a028804000000b0035b742582afmr25020059jai.21.1666724798384; 
 Tue, 25 Oct 2022 12:06:38 -0700 (PDT)
Received: from smtpclient.apple ([198.30.180.98])
 by smtp.gmail.com with ESMTPSA id
 b18-20020a026f52000000b003725d3b06a0sm1203253jae.45.2022.10.25.12.06.37
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 25 Oct 2022 12:06:37 -0700 (PDT)
From: JD Smith <jdtsmith@HIDDEN>
Content-Type: multipart/alternative;
 boundary="Apple-Mail=_3636E09C-4CCF-46BC-A583-CB48DF1BEB5C"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\))
Subject: python.el infinite loop in info-current-defun
Message-Id: <4C66FAFB-EB0E-464D-9D26-51A251FF80CC@HIDDEN>
Date: Tue, 25 Oct 2022 15:06:36 -0400
To: bug-gnu-emacs@HIDDEN
X-Mailer: Apple Mail (2.3696.120.41.1.1)
Received-SPF: pass client-ip=2607:f8b0:4864:20::d33;
 envelope-from=jdtsmith@HIDDEN; helo=mail-io1-xd33.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)


--Apple-Mail=_3636E09C-4CCF-46BC-A583-CB48DF1BEB5C
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

I noticed python.el hangs hard on some of my files when =
`python-info-current-defun` is set up for use with which-function, and I =
open (but haven=E2=80=99t yet closed) a triple string: =E2=80=9C=E2=80=9D"=
.  I tracked this down to a bug in `python-nav-end-of-statement` when an =
unclosed string is included in a file:

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
def try():
    """Do the Foo

def a():
    """Do A's stuff"""
    a =3D True

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

(Note: the final newline is important).  (python-info-current-defun) =
hangs on the unclosed docsig string of try(). =20

The reason why can be demonstrated by placing the cursor before a =3D =
True on the final line and (python-nav-end-of-statement).  Point moves =
to the end of the previous line!   Since `python-nav-end-of-defun` calls =
end-of-statement repeatedly looking for (eobp), this results in an =
infinite loop.  The problem is this call in end-of-statement:

  (re-search-forward (rx (syntax string-delimiter)) nil t)

Search starts at the single apostrophe in Do A=E2=80=99s stuff (the =
beginning of the apparent-but-incorrect string ppss has found), then =
searches forward to the triple quote at the end of the (prior) line. =20

To reproduce this you need:

- an unclosed triple string above
- a triple string with another type of quote mark enclosed
- something after the final =E2=80=9C=E2=80=9D=E2=80=9D (to prevent =
eobp).=20

These are surprisingly common conditions to encounter given python =
docstring format.  A fix might be to insist that the =
`python-nav-end-of-statement` occurs at least at the end of the current =
line, or perhaps to improve the regex search for the end of string to =
match the opening string delimiter (although this could also be fooled I =
think).

This is Emacs 28, though aside from some additional commentary about =
such issues, end-of-statement hasn=E2=80=99t changed in the latest.=20

As an aside, having stepped through this code, it seems python=E2=80=99s =
structural navigation and inspection are _very_ heavy, commonly =
traversing entire files one statement at a time to find the local =
function name, for example.  Due to their complexity, they are also =
susceptible to these types of infinite loops when syntax is in a =
temporarily broken state.  Good arguments for the inclusion of =
tree-sitter!


--Apple-Mail=_3636E09C-4CCF-46BC-A583-CB48DF1BEB5C
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;" class=3D"">I =
noticed python.el hangs hard on some of my files when =
`python-info-current-defun` is set up for use with which-function, and I =
open (but haven=E2=80=99t yet closed) a triple string: =E2=80=9C=E2=80=9D"=
. &nbsp;I tracked this down to a bug in `python-nav-end-of-statement` =
when an unclosed string is included in a file:<div class=3D""><br =
class=3D""></div><div class=3D"">=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</div><div =
class=3D""><div class=3D"">def try():</div><div class=3D"">&nbsp; &nbsp; =
"""Do the Foo</div><div class=3D""><br class=3D""></div><div =
class=3D"">def a():</div><div class=3D"">&nbsp; &nbsp; """Do A's =
stuff"""</div><div class=3D"">&nbsp; &nbsp; a =3D True</div></div><div =
class=3D""><br class=3D""></div><div class=3D"">=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D</div><div class=3D""><br class=3D""></div><div class=3D"">(Note: =
the final newline is important). &nbsp;<span style=3D"caret-color: =
rgb(0, 0, 0); color: rgb(0, 0, 0);" class=3D"">(python-info-current-defun)=
 hangs on the unclosed docsig string of try(). &nbsp;</span></div><div =
class=3D""><span style=3D"caret-color: rgb(0, 0, 0); color: rgb(0, 0, =
0);" class=3D""><br class=3D""></span></div><div class=3D""><span =
style=3D"caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class=3D"">The =
reason why can be demonstrated by placing the cursor before a =3D True =
on the final line and&nbsp;</span><font color=3D"#000000" class=3D""><span=
 style=3D"caret-color: rgb(0, 0, 0);" =
class=3D"">(python-nav-end-of-statement). &nbsp;Point moves to the end =
of the previous line! &nbsp;&nbsp;</span></font><span =
style=3D"caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class=3D"">Since=
 `python-nav-end-of-defun` calls end-of-statement repeatedly looking for =
(eobp), this results in an infinite loop. &nbsp;The problem is this call =
in end-of-statement:</span></div><div class=3D""><font color=3D"#000000" =
class=3D""><span style=3D"caret-color: rgb(0, 0, 0);" class=3D""><br =
class=3D""></span></font></div><div class=3D""><font color=3D"#000000" =
class=3D""><span style=3D"caret-color: rgb(0, 0, 0);" class=3D""><div =
class=3D"">&nbsp; (re-search-forward (rx (syntax string-delimiter)) nil =
t)</div><div class=3D""><br class=3D""></div><div class=3D"">Search =
starts at the single apostrophe in Do A=E2=80=99s stuff (the beginning =
of the apparent-but-incorrect string ppss has found), then searches =
forward to the triple quote at the end of the (prior) line. =
&nbsp;</div></span></font></div><div class=3D""><br class=3D""></div><div =
class=3D""><font color=3D"#000000" class=3D""><span style=3D"caret-color: =
rgb(0, 0, 0);" class=3D"">To reproduce this you =
need:</span></font></div><div class=3D""><font color=3D"#000000" =
class=3D""><span style=3D"caret-color: rgb(0, 0, 0);" class=3D""><br =
class=3D""></span></font></div><div class=3D""><font color=3D"#000000" =
class=3D""><span style=3D"caret-color: rgb(0, 0, 0);" class=3D"">- an =
unclosed triple string above</span></font></div><div class=3D""><font =
color=3D"#000000" class=3D""><span style=3D"caret-color: rgb(0, 0, 0);" =
class=3D"">- a triple string with another type of quote mark =
enclosed</span></font></div><div class=3D""><font color=3D"#000000" =
class=3D"">- something after the final&nbsp;=E2=80=9C=E2=80=9D=E2=80=9D =
(to prevent eobp).&nbsp;</font></div><div class=3D""><font =
color=3D"#000000" class=3D""><span style=3D"caret-color: rgb(0, 0, 0);" =
class=3D""><br class=3D""></span></font></div><div class=3D""><font =
color=3D"#000000" class=3D"">These are&nbsp;surprisingly common =
conditions to encounter given python docstring format. &nbsp;A fix might =
be to&nbsp;insist that the `python-nav-end-of-statement` occurs at least =
at the end of the current line, or perhaps to =
improve&nbsp;the&nbsp;regex search for the end of string to&nbsp;match =
the opening string&nbsp;delimiter (although this&nbsp;could also be =
fooled I think).</font></div><div class=3D""><br class=3D""></div><div =
class=3D"">This is Emacs 28, though aside from some additional =
commentary about such issues, end-of-statement hasn=E2=80=99t changed in =
the latest.&nbsp;</div><div class=3D""><br class=3D""></div><div =
class=3D""><font color=3D"#000000" class=3D"">As an aside, having =
stepped through this code, it seems python=E2=80=99s structural =
navigation and inspection are _very_ heavy, commonly traversing entire =
files one statement at a time to find the local function name, for =
example. &nbsp;Due to their complexity, they are also&nbsp;<span =
style=3D"caret-color: rgb(0, 0, 0);" class=3D"">susceptible to these =
types of infinite loops when syntax is in a temporarily broken state. =
&nbsp;Good arguments for the inclusion of =
tree-sitter!</span></font></div><div class=3D""><br =
class=3D""></div></body></html>=

--Apple-Mail=_3636E09C-4CCF-46BC-A583-CB48DF1BEB5C--




Acknowledgement sent to JD Smith <jdtsmith@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#58780; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 6 Dec 2022 01:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.