From: shynur Date: Fri, 3 May 2024 11:40:23 +0000 (+0800) Subject: Locate error source of ExceptionGroup in Python shell X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8819c9a7f57a94d4fdc77275d89951098f6e3b91;p=emacs.git 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. (cherry picked from commit bfb31a06acadd5e819a3cb8dc6886122e53646f3) --- diff --git a/etc/NEWS b/etc/NEWS index 875a7d2cdb1..07d0dc6e2a8 100644 --- 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. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 5ba185bc60c..e332bd8f61e 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -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 `' &c "\", line " (group (1+ digit))) 1 2)