]> git.eshelyaron.com Git - emacs.git/commitdiff
Locate error source of ExceptionGroup in Python shell
authorshynur <one.last.kiss@outlook.com>
Fri, 3 May 2024 11:40:23 +0000 (19:40 +0800)
committerEshel Yaron <me@eshelyaron.com>
Mon, 6 May 2024 16:38:46 +0000 (18:38 +0200)
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.

(cherry picked from commit bfb31a06acadd5e819a3cb8dc6886122e53646f3)

etc/NEWS
lisp/progmodes/python.el

index 875a7d2cdb1afa014cf73015fac21d01d9206233..07d0dc6e2a8668e4623e546f48667ae9ab4ef952 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1449,6 +1449,14 @@ interactive Python interpreter specified by 'python-interpreter'.
 It sends the python block delimited by 'python-nav-beginning-of-block'
 and 'python-nav-end-of-block' to the inferior Python process.
 
+** 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.
index 5ba185bc60c9c861c6d6cb9a74939507ec178386..e332bd8f61ec4d069d197521de1c0543509f6140 100644 (file)
@@ -2860,7 +2860,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)