* bug#70653: [PATCH] Support source line location for Python ExceptionGroup
@ 2024-04-29 16:24 . shynur
2024-04-29 16:31 ` bug#70653: #70653 PATCH here . shynur
2024-04-29 16:48 ` bug#70653: [PATCH] Support source line location for Python ExceptionGroup Eli Zaretskii
0 siblings, 2 replies; 11+ messages in thread
From: . shynur @ 2024-04-29 16:24 UTC (permalink / raw)
To: 70653
(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
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#70653: #70653 PATCH here
2024-04-29 16:24 bug#70653: [PATCH] Support source line location for Python ExceptionGroup . shynur
@ 2024-04-29 16:31 ` . shynur
2024-05-02 9:28 ` Eli Zaretskii
2024-04-29 16:48 ` bug#70653: [PATCH] Support source line location for Python ExceptionGroup Eli Zaretskii
1 sibling, 1 reply; 11+ messages in thread
From: . shynur @ 2024-04-29 16:31 UTC (permalink / raw)
To: 70653@debbugs.gnu.org
[-- Attachment #1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2: 0001-Locate-source-for-ExceptionGroup.patch --]
[-- Type: application/octet-stream, Size: 816 bytes --]
From 2621fd2bf52ea73dbb0b17701cda87a856ef6096 Mon Sep 17 00:00:00 2001
From: shynur <one.last.kiss@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
^ permalink raw reply related [flat|nested] 11+ messages in thread
* bug#70653: #70653 PATCH here
2024-04-29 16:31 ` bug#70653: #70653 PATCH here . shynur
@ 2024-05-02 9:28 ` Eli Zaretskii
0 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2024-05-02 9:28 UTC (permalink / raw)
To: . shynur, kobarity; +Cc: 70653
> From: ". shynur" <one.last.kiss@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@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.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#70653: [PATCH] Support source line location for Python ExceptionGroup
2024-04-29 16:24 bug#70653: [PATCH] Support source line location for Python ExceptionGroup . shynur
2024-04-29 16:31 ` bug#70653: #70653 PATCH here . shynur
@ 2024-04-29 16:48 ` Eli Zaretskii
2024-04-30 7:27 ` kobarity
1 sibling, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2024-04-29 16:48 UTC (permalink / raw)
To: . shynur, kobarity; +Cc: 70653
> From: ". shynur" <one.last.kiss@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.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#70653: [PATCH] Support source line location for Python ExceptionGroup
2024-04-29 16:48 ` bug#70653: [PATCH] Support source line location for Python ExceptionGroup Eli Zaretskii
@ 2024-04-30 7:27 ` kobarity
2024-04-30 10:24 ` . shynur
2024-05-02 9:35 ` Eli Zaretskii
0 siblings, 2 replies; 11+ messages in thread
From: kobarity @ 2024-04-30 7:27 UTC (permalink / raw)
To: . shynur, Eli Zaretskii; +Cc: 70653
[-- Attachment #1: Type: text/plain, Size: 1353 bytes --]
Eli Zaretskii wrote:
>
> > From: ". shynur" <one.last.kiss@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?
[-- Attachment #2: 0001-Add-ExceptionGroup-as-a-Python-keyword.patch --]
[-- Type: application/octet-stream, Size: 1269 bytes --]
From 7af54b1e4c4ec9ff9eeebef52d9389f4064a7d20 Mon Sep 17 00:00:00 2001
From: kobarity <kobarity@gmail.com>
Date: Tue, 30 Apr 2024 14:10:57 +0900
Subject: [PATCH] Add ExceptionGroup as a Python keyword
* lisp/progmodes/python.el (python-font-lock-keywords-maximum-decoration):
(python--treesit-exceptions): Add ExceptionGroup.
---
lisp/progmodes/python.el | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 3f72295c808..eb913a4e68d 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -785,6 +785,7 @@ python-font-lock-keywords-maximum-decoration
"InterruptedError" "IsADirectoryError" "NotADirectoryError"
"PermissionError" "ProcessLookupError" "RecursionError"
"ResourceWarning" "StopAsyncIteration" "TimeoutError"
+ "ExceptionGroup"
;; OS specific
"VMSError" "WindowsError"
)
@@ -1052,6 +1053,7 @@ python--treesit-exceptions
"InterruptedError" "IsADirectoryError" "NotADirectoryError"
"PermissionError" "ProcessLookupError" "RecursionError"
"ResourceWarning" "StopAsyncIteration" "TimeoutError"
+ "ExceptionGroup"
;; OS specific
"VMSError" "WindowsError"
))
--
2.34.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* bug#70653: [PATCH] Support source line location for Python ExceptionGroup
2024-04-30 7:27 ` kobarity
@ 2024-04-30 10:24 ` . shynur
2024-05-01 8:16 ` kobarity
2024-05-02 9:36 ` Eli Zaretskii
2024-05-02 9:35 ` Eli Zaretskii
1 sibling, 2 replies; 11+ messages in thread
From: . shynur @ 2024-04-30 10:24 UTC (permalink / raw)
To: kobarity; +Cc: 70653@debbugs.gnu.org
[-- Attachment #1: Type: text/plain, Size: 305 bytes --]
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.
[-- Attachment #2: 0001-Locate-error-source-of-ExceptionGroup-in-Python-shel.patch --]
[-- Type: application/octet-stream, Size: 1578 bytes --]
From 80b974b35a6d38ea4f650db8c1e02cbc5f4bdb7c Mon Sep 17 00:00:00 2001
From: shynur <one.last.kiss@outlook.com>
Date: Tue, 30 Apr 2024 18:08:48 +0800
Subject: [PATCH] Locate error source of ExceptionGroup in Python shell
---
etc/NEWS | 8 ++++++++
lisp/progmodes/python.el | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/etc/NEWS b/etc/NEWS
index 4b0106fcb07..f7da11b67c9 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1347,6 +1347,14 @@ instead of:
This allows the user to specify command line arguments to the non
interactive Python interpreter specified by 'python-interpreter'.
+** Inferior Python mode
+
+---
+*** Default value of 'python-shell-compilation-regexp-alist' is changed.
+Support for Python's ExceptionGroup has been added, so in the Python
+shell, the line indicating the source of error in the error messages
+from ExceptionGroup will be recognized as well.
+
** Scheme mode
Scheme mode now handles regular expression literal '#/regexp/' that is
available in some Scheme implementations.
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
^ permalink raw reply related [flat|nested] 11+ messages in thread
* bug#70653: [PATCH] Support source line location for Python ExceptionGroup
2024-04-30 10:24 ` . shynur
@ 2024-05-01 8:16 ` kobarity
2024-05-02 9:36 ` Eli Zaretskii
1 sibling, 0 replies; 11+ messages in thread
From: kobarity @ 2024-05-01 8:16 UTC (permalink / raw)
To: . shynur, Eli Zaretskii; +Cc: 70653@debbugs.gnu.org
[-- Attachment #1: Type: text/plain, Size: 690 bytes --]
. 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.
[-- Attachment #2: 0001-Add-ExceptionGroup-as-a-Python-keyword.patch --]
[-- Type: application/octet-stream, Size: 1280 bytes --]
From 74c5dcb2fa1349b7854ecbed600aeeb6a1799e59 Mon Sep 17 00:00:00 2001
From: kobarity <kobarity@gmail.com>
Date: Wed, 1 May 2024 17:03:52 +0900
Subject: [PATCH] Add ExceptionGroup as a Python keyword
* lisp/progmodes/python.el (python-font-lock-keywords-maximum-decoration):
(python--treesit-exceptions): Add ExceptionGroup. (Bug#70653)
---
lisp/progmodes/python.el | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 3f72295c808..eb913a4e68d 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -785,6 +785,7 @@ python-font-lock-keywords-maximum-decoration
"InterruptedError" "IsADirectoryError" "NotADirectoryError"
"PermissionError" "ProcessLookupError" "RecursionError"
"ResourceWarning" "StopAsyncIteration" "TimeoutError"
+ "ExceptionGroup"
;; OS specific
"VMSError" "WindowsError"
)
@@ -1052,6 +1053,7 @@ python--treesit-exceptions
"InterruptedError" "IsADirectoryError" "NotADirectoryError"
"PermissionError" "ProcessLookupError" "RecursionError"
"ResourceWarning" "StopAsyncIteration" "TimeoutError"
+ "ExceptionGroup"
;; OS specific
"VMSError" "WindowsError"
))
--
2.34.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* bug#70653: [PATCH] Support source line location for Python ExceptionGroup
2024-04-30 10:24 ` . shynur
2024-05-01 8:16 ` kobarity
@ 2024-05-02 9:36 ` Eli Zaretskii
2024-05-03 11:48 ` shynur .
1 sibling, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2024-05-02 9:36 UTC (permalink / raw)
To: . shynur; +Cc: kobarity, 70653
> Cc: "70653@debbugs.gnu.org" <70653@debbugs.gnu.org>
> From: ". shynur" <one.last.kiss@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.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#70653: [PATCH] Support source line location for Python ExceptionGroup
2024-05-02 9:36 ` Eli Zaretskii
@ 2024-05-03 11:48 ` shynur .
2024-05-04 11:53 ` Eli Zaretskii
0 siblings, 1 reply; 11+ messages in thread
From: shynur . @ 2024-05-03 11:48 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 70653@debbugs.gnu.org
[-- Attachment #1: Type: text/plain, Size: 236 bytes --]
>> 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.
[-- Attachment #2: 0001-Locate-error-source-of-ExceptionGroup-in-Python-shel.patch --]
[-- Type: application/octet-stream, Size: 1976 bytes --]
From d66f7e36b273c4328905a375a853032f86bd20e2 Mon Sep 17 00:00:00 2001
From: shynur <one.last.kiss@outlook.com>
Date: Fri, 3 May 2024 19:40:23 +0800
Subject: [PATCH] Locate error source of ExceptionGroup in Python shell
The Python shell recognizes the line containing a file path and
a line number when an exception is raised up to the top-level,
in order to locate the source of error. It's supposed to
recognize the built-in ExceptionGroup as well. (Bug#70653)
* lisp/progmodes/python.el (python-shell-compilation-regexp-alist):
Take the single leading vertical line into account.
* etc/NEWS: Announce this change.
---
etc/NEWS | 8 ++++++++
lisp/progmodes/python.el | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/etc/NEWS b/etc/NEWS
index 4b0106fcb07..f7da11b67c9 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1347,6 +1347,14 @@ instead of:
This allows the user to specify command line arguments to the non
interactive Python interpreter specified by 'python-interpreter'.
+** Inferior Python mode
+
+---
+*** Default value of 'python-shell-compilation-regexp-alist' is changed.
+Support for Python's ExceptionGroup has been added, so in the Python
+shell, the line indicating the source of error in the error messages
+from ExceptionGroup will be recognized as well.
+
** Scheme mode
Scheme mode now handles regular expression literal '#/regexp/' that is
available in some Scheme implementations.
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
^ permalink raw reply related [flat|nested] 11+ messages in thread
* bug#70653: [PATCH] Support source line location for Python ExceptionGroup
2024-05-03 11:48 ` shynur .
@ 2024-05-04 11:53 ` Eli Zaretskii
0 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2024-05-04 11:53 UTC (permalink / raw)
To: shynur .; +Cc: 70653-done
> From: "shynur ." <one.last.kiss@outlook.com>
> CC: "70653@debbugs.gnu.org" <70653@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.)
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#70653: [PATCH] Support source line location for Python ExceptionGroup
2024-04-30 7:27 ` kobarity
2024-04-30 10:24 ` . shynur
@ 2024-05-02 9:35 ` Eli Zaretskii
1 sibling, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2024-05-02 9:35 UTC (permalink / raw)
To: kobarity; +Cc: one.last.kiss, 70653
> Date: Tue, 30 Apr 2024 16:27:30 +0900
> From: kobarity <kobarity@gmail.com>
> Cc: 70653@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.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2024-05-04 11:53 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-29 16:24 bug#70653: [PATCH] Support source line location for Python ExceptionGroup . shynur
2024-04-29 16:31 ` bug#70653: #70653 PATCH here . shynur
2024-05-02 9:28 ` Eli Zaretskii
2024-04-29 16:48 ` bug#70653: [PATCH] Support source line location for Python ExceptionGroup Eli Zaretskii
2024-04-30 7:27 ` kobarity
2024-04-30 10:24 ` . shynur
2024-05-01 8:16 ` kobarity
2024-05-02 9:36 ` Eli Zaretskii
2024-05-03 11:48 ` shynur .
2024-05-04 11:53 ` Eli Zaretskii
2024-05-02 9:35 ` Eli Zaretskii
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.