GNU bug report logs - #70653
[PATCH] Support source line location for Python ExceptionGroup

Previous Next

Package: emacs;

Reported by: ". shynur" <one.last.kiss <at> outlook.com>

Date: Mon, 29 Apr 2024 16:30:02 UTC

Severity: normal

Tags: patch

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

To reply to this bug, email your comments to 70653 AT debbugs.gnu.org.
There is no need to reopen the bug first.

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#70653; Package emacs. (Mon, 29 Apr 2024 16:30:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to ". shynur" <one.last.kiss <at> outlook.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 29 Apr 2024 16:30:03 GMT) Full text and rfc822 format available.

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

From: ". shynur" <one.last.kiss <at> outlook.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: [PATCH] Support source line location for Python ExceptionGroup
Date: Mon, 29 Apr 2024 16:24:10 +0000
(This patch is written for Inferior Python mode.)

The original behavior considered only the case of
single exception:

```
Traceback (most recent call last):
  File "<string>", line 17, in __PYTHON_EL_eval
  File "c:/Users/shynur/Desktop/Python/a.py", line 1, in <module>
    raise Exception
Exception
```

In the above example, one can click at the 3rd line to jump
to the corresponding source line.  This patch adds support
for the following case (i.e., the built-in ExceptionGroup):

```
+ Exception Group Traceback (most recent call last):
  |   File "<string>", line 17, in __PYTHON_EL_eval
  |   File "c:/Users/shynur/Desktop/Python/a.py", line 1, in <module>
  |     raise ExceptionGroup("", [Exception()])
  | ExceptionGroup:  (1 sub-exception)
  +-+---------------- 1 ----------------
    | Exception
    +------------------------------------
```

--
shynur

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70653; Package emacs. (Mon, 29 Apr 2024 16:32:01 GMT) Full text and rfc822 format available.

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

From: ". shynur" <one.last.kiss <at> outlook.com>
To: "70653 <at> debbugs.gnu.org" <70653 <at> debbugs.gnu.org>
Subject: #70653 PATCH here
Date: Mon, 29 Apr 2024 16:31:00 +0000
[Message part 1 (text/plain, inline)]

[0001-Locate-source-for-ExceptionGroup.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70653; Package emacs. (Mon, 29 Apr 2024 16:50:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: ". shynur" <one.last.kiss <at> outlook.com>, kobarity <kobarity <at> gmail.com>
Cc: 70653 <at> debbugs.gnu.org
Subject: Re: bug#70653: [PATCH] Support source line location for Python
 ExceptionGroup
Date: Mon, 29 Apr 2024 19:48:56 +0300
> From: ". shynur" <one.last.kiss <at> outlook.com>
> Date: Mon, 29 Apr 2024 16:24:10 +0000
> msip_labels: 
> 
> (This patch is written for Inferior Python mode.)
> 
> The original behavior considered only the case of
> single exception:
> 
> ```
> Traceback (most recent call last):
>   File "<string>", line 17, in __PYTHON_EL_eval
>   File "c:/Users/shynur/Desktop/Python/a.py", line 1, in <module>
>     raise Exception
> Exception
> ```
> 
> In the above example, one can click at the 3rd line to jump
> to the corresponding source line.  This patch adds support
> for the following case (i.e., the built-in ExceptionGroup):
> 
> ```
> + Exception Group Traceback (most recent call last):
>   |   File "<string>", line 17, in __PYTHON_EL_eval
>   |   File "c:/Users/shynur/Desktop/Python/a.py", line 1, in <module>
>   |     raise ExceptionGroup("", [Exception()])
>   | ExceptionGroup:  (1 sub-exception)
>   +-+---------------- 1 ----------------
>     | Exception
>     +------------------------------------
> ```

Adding kobarity to the discussion.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70653; Package emacs. (Tue, 30 Apr 2024 07:29:02 GMT) Full text and rfc822 format available.

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

From: kobarity <kobarity <at> gmail.com>
To: ". shynur" <one.last.kiss <at> outlook.com>,
	Eli Zaretskii <eliz <at> gnu.org>
Cc: 70653 <at> debbugs.gnu.org
Subject: Re: bug#70653: [PATCH] Support source line location for Python
 ExceptionGroup
Date: Tue, 30 Apr 2024 16:27:30 +0900
[Message part 1 (text/plain, inline)]
Eli Zaretskii wrote:
> 
> > From: ". shynur" <one.last.kiss <at> outlook.com>
> > Date: Mon, 29 Apr 2024 16:24:10 +0000
> > msip_labels: 
> > 
> > (This patch is written for Inferior Python mode.)
> > 
> > The original behavior considered only the case of
> > single exception:
> > 
> > ```
> > Traceback (most recent call last):
> >   File "<string>", line 17, in __PYTHON_EL_eval
> >   File "c:/Users/shynur/Desktop/Python/a.py", line 1, in <module>
> >     raise Exception
> > Exception
> > ```
> > 
> > In the above example, one can click at the 3rd line to jump
> > to the corresponding source line.  This patch adds support
> > for the following case (i.e., the built-in ExceptionGroup):
> > 
> > ```
> > + Exception Group Traceback (most recent call last):
> >   |   File "<string>", line 17, in __PYTHON_EL_eval
> >   |   File "c:/Users/shynur/Desktop/Python/a.py", line 1, in <module>
> >   |     raise ExceptionGroup("", [Exception()])
> >   | ExceptionGroup:  (1 sub-exception)
> >   +-+---------------- 1 ----------------
> >     | Exception
> >     +------------------------------------
> > ```
> 
> Adding kobarity to the discussion.

It looks good to me.  Is it better to write NEWS since it is a change
of the customize variable?

Maybe we should also add ExceptionGroup as a Python keyword.  The
patch is attached.  Should I open a new bug?
[0001-Add-ExceptionGroup-as-a-Python-keyword.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70653; Package emacs. (Tue, 30 Apr 2024 10:26:02 GMT) Full text and rfc822 format available.

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

From: ". shynur" <one.last.kiss <at> outlook.com>
To: kobarity <kobarity <at> gmail.com>
Cc: "70653 <at> debbugs.gnu.org" <70653 <at> debbugs.gnu.org>
Subject: Re: bug#70653: [PATCH] Support source line location for Python
 ExceptionGroup
Date: Tue, 30 Apr 2024 10:24:47 +0000
[Message part 1 (text/plain, inline)]
kobarity:
> Is it better to write NEWS since it is a change of the
> customize variable?

Aye.  The new patch is attached.
It contains a corresponding NEWS item.

> Maybe we should also add ExceptionGroup as a Python
> keyword.

If the built-in Exception is a keyword, ExceptionGroup
can also be, I think.
[0001-Locate-error-source-of-ExceptionGroup-in-Python-shel.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70653; Package emacs. (Wed, 01 May 2024 08:17:01 GMT) Full text and rfc822 format available.

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

From: kobarity <kobarity <at> gmail.com>
To: ". shynur" <one.last.kiss <at> outlook.com>, Eli Zaretskii <eliz <at> gnu.org>
Cc: "70653 <at> debbugs.gnu.org" <70653 <at> debbugs.gnu.org>
Subject: Re: bug#70653: [PATCH] Support source line location for Python
 ExceptionGroup
Date: Wed, 01 May 2024 17:16:07 +0900
[Message part 1 (text/plain, inline)]
. shynur wrote:
> 
> kobarity:
> > Is it better to write NEWS since it is a change of the
> > customize variable?
> 
> Aye.  The new patch is attached.
> It contains a corresponding NEWS item.

Thanks, it looks good to me.
I think it would be helpful for the committer to have a ChangeLog
entry and the bug number in the commit message.

> > Maybe we should also add ExceptionGroup as a Python
> > keyword.
> 
> If the built-in Exception is a keyword, ExceptionGroup
> can also be, I think.

Yes, Exception is already a keyword.

Eli,
I updated my patch to include the bug number. Please commit it if you
think it's OK.  If you think that another bug should be opened, please
let me know.
[0001-Add-ExceptionGroup-as-a-Python-keyword.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70653; Package emacs. (Thu, 02 May 2024 09:30:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: ". shynur" <one.last.kiss <at> outlook.com>, kobarity <kobarity <at> gmail.com>
Cc: 70653 <at> debbugs.gnu.org
Subject: Re: bug#70653: #70653 PATCH here
Date: Thu, 02 May 2024 12:28:49 +0300
> From: ". shynur" <one.last.kiss <at> outlook.com>
> Date: Mon, 29 Apr 2024 16:31:00 +0000
> 
> From 2621fd2bf52ea73dbb0b17701cda87a856ef6096 Mon Sep 17 00:00:00 2001
> From: shynur <one.last.kiss <at> outlook.com>
> Date: Tue, 30 Apr 2024 00:08:06 +0800
> Subject: [PATCH] Locate source for ExceptionGroup
> 
> ---
>  lisp/progmodes/python.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
> index d6c29e5ffc6..3f72295c808 100644
> --- a/lisp/progmodes/python.el
> +++ b/lisp/progmodes/python.el
> @@ -2854,7 +2854,7 @@ virtualenv."
>    :type '(repeat symbol))
>  
>  (defcustom python-shell-compilation-regexp-alist
> -  `((,(rx line-start (1+ (any " \t")) "File \""
> +  `((,(rx line-start (1+ (any " \t")) (? ?| (1+ (any " \t"))) "File \""
>            (group (1+ (not (any "\"<")))) ; avoid `<stdin>' &c
>            "\", line " (group (1+ digit)))
>       1 2)
> -- 
> 2.43.0

Any comments on this proposal?

I have one minor comment: please accompany the change with the
ChangeLog-style commit log message, per the description in CONTRIBUTE.
A more detailed description of the motivation and rationale for this
patch will also be appreciated.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70653; Package emacs. (Thu, 02 May 2024 09:36:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: kobarity <kobarity <at> gmail.com>
Cc: one.last.kiss <at> outlook.com, 70653 <at> debbugs.gnu.org
Subject: Re: bug#70653: [PATCH] Support source line location for Python
 ExceptionGroup
Date: Thu, 02 May 2024 12:35:13 +0300
> Date: Tue, 30 Apr 2024 16:27:30 +0900
> From: kobarity <kobarity <at> gmail.com>
> Cc: 70653 <at> debbugs.gnu.org
> 
> Maybe we should also add ExceptionGroup as a Python keyword.  The
> patch is attached.  Should I open a new bug?

No need for a new bug, I installed this on master.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70653; Package emacs. (Thu, 02 May 2024 09:38:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: ". shynur" <one.last.kiss <at> outlook.com>
Cc: kobarity <at> gmail.com, 70653 <at> debbugs.gnu.org
Subject: Re: bug#70653: [PATCH] Support source line location for Python
 ExceptionGroup
Date: Thu, 02 May 2024 12:36:36 +0300
> Cc: "70653 <at> debbugs.gnu.org" <70653 <at> debbugs.gnu.org>
> From: ". shynur" <one.last.kiss <at> outlook.com>
> Date: Tue, 30 Apr 2024 10:24:47 +0000
> 
> kobarity:
> > Is it better to write NEWS since it is a change of the
> > customize variable?
> 
> Aye.  The new patch is attached.
> It contains a corresponding NEWS item.

Thanks, but the ChangeLog style list of changes is still missing.
Please add them, and then I can install.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70653; Package emacs. (Fri, 03 May 2024 11:50:02 GMT) Full text and rfc822 format available.

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

From: "shynur ." <one.last.kiss <at> outlook.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: "70653 <at> debbugs.gnu.org" <70653 <at> debbugs.gnu.org>
Subject: Re: bug#70653: [PATCH] Support source line location for Python
 ExceptionGroup
Date: Fri, 3 May 2024 11:48:32 +0000
[Message part 1 (text/plain, inline)]
>> Aye.  The new patch is attached.
>> It contains a corresponding NEWS item.
>
> Thanks, but the ChangeLog style list of changes is still missing.
> Please add them, and then I can install.

I added them.  Please review.  Thanks.
[0001-Locate-error-source-of-ExceptionGroup-in-Python-shel.patch (application/octet-stream, attachment)]

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 04 May 2024 11:54:02 GMT) Full text and rfc822 format available.

Notification sent to ". shynur" <one.last.kiss <at> outlook.com>:
bug acknowledged by developer. (Sat, 04 May 2024 11:54:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: "shynur ." <one.last.kiss <at> outlook.com>
Cc: 70653-done <at> debbugs.gnu.org
Subject: Re: bug#70653: [PATCH] Support source line location for Python
 ExceptionGroup
Date: Sat, 04 May 2024 14:53:03 +0300
> From: "shynur ." <one.last.kiss <at> outlook.com>
> CC: "70653 <at> debbugs.gnu.org" <70653 <at> debbugs.gnu.org>
> Date: Fri, 3 May 2024 11:48:32 +0000
> msip_labels:
> 
> >> Aye.  The new patch is attached.
> >> It contains a corresponding NEWS item.
> >
> > Thanks, but the ChangeLog style list of changes is still missing.
> > Please add them, and then I can install.
> 
> I added them.  Please review.  Thanks.

Thanks, installed on master, and closing the bug.

Please in the future remember to add/update the :version tag when you
modify the default value of a defcustom or a defface.  (I did it for
you this time.)




This bug report was last modified 12 days ago.

Previous Next


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