GNU bug report logs - #68284
[PATCH] Fix python-info-docstring-p bug in the 2nd line of a buffer

Previous Next

Package: emacs;

Reported by: kobarity <kobarity <at> gmail.com>

Date: Sat, 6 Jan 2024 13:14:01 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 68284 in the body.
You can then email your comments to 68284 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#68284; Package emacs. (Sat, 06 Jan 2024 13:14:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to kobarity <kobarity <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 06 Jan 2024 13:14:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: kobarity <kobarity <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Fix python-info-docstring-p bug in the 2nd line of a buffer
Date: Sat, 06 Jan 2024 22:12:36 +0900
[Message part 1 (text/plain, inline)]
Hi,

No matter what the first line of the buffer is, if the second line is
a string literal, `python-info-docstring-p` will misjudge it as a
docstring.  This issue can be reproduced as follows:

1. emacs -Q
2. Open a Python file whose contents are as follows:

#+begin_src python
import sys
"""Not a docstring."""
#+end_src

3. Locate the point at the string literal on the second line.
4. M-: (python-info-docstring-p)

Although this string literal is not a docstring, it returns t.
Therefore, in `python-mode` (not `python-ts-mode`), this string
literal is rendered in `font-lock-doc-face`.

This is the reason I changed some ERTs to "expected fail" in the
commit b7b82ecb2b4c2ce33c11e5388b692cd403ab55e6 of Bug#63622.

Attached is a patch to fix this bug and the above mentioned ERTs and
to restore ERTs I deleted by mistake in commit
6b2c8dc9050c5c0514fa404733ce1d4a37d00e39 of Bug#63844 (related to
Bug#63622).

--
In GNU Emacs 30.0.50 (build 3, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.16.0, Xaw scroll bars) of 2024-01-03 built on ubuntu
Repository revision: 91bc775b0c60342f118640001d2ce293d4f1f7ef
Repository branch: master
System Description: Ubuntu 22.04.3 LTS
[0001-Fix-python-info-docstring-p-bug-in-the-2nd-line-of-a.patch (application/octet-stream, attachment)]

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 13 Jan 2024 09:36:02 GMT) Full text and rfc822 format available.

Notification sent to kobarity <kobarity <at> gmail.com>:
bug acknowledged by developer. (Sat, 13 Jan 2024 09:36:02 GMT) Full text and rfc822 format available.

Message #10 received at 68284-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: kobarity <kobarity <at> gmail.com>
Cc: 68284-done <at> debbugs.gnu.org
Subject: Re: bug#68284: [PATCH] Fix python-info-docstring-p bug in the 2nd
 line of a buffer
Date: Sat, 13 Jan 2024 11:34:38 +0200
> Date: Sat, 06 Jan 2024 22:12:36 +0900
> From: kobarity <kobarity <at> gmail.com>
> 
> No matter what the first line of the buffer is, if the second line is
> a string literal, `python-info-docstring-p` will misjudge it as a
> docstring.  This issue can be reproduced as follows:
> 
> 1. emacs -Q
> 2. Open a Python file whose contents are as follows:
> 
> #+begin_src python
> import sys
> """Not a docstring."""
> #+end_src
> 
> 3. Locate the point at the string literal on the second line.
> 4. M-: (python-info-docstring-p)
> 
> Although this string literal is not a docstring, it returns t.
> Therefore, in `python-mode` (not `python-ts-mode`), this string
> literal is rendered in `font-lock-doc-face`.
> 
> This is the reason I changed some ERTs to "expected fail" in the
> commit b7b82ecb2b4c2ce33c11e5388b692cd403ab55e6 of Bug#63622.
> 
> Attached is a patch to fix this bug and the above mentioned ERTs and
> to restore ERTs I deleted by mistake in commit
> 6b2c8dc9050c5c0514fa404733ce1d4a37d00e39 of Bug#63844 (related to
> Bug#63622).

Thanks, installed on the master branch, and closing the bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 10 Feb 2024 12:24:18 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 130 days ago.

Previous Next


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