[Python-checkins] gh-102192: use PyErr_SetHandledException instead of the legacy PyErr_SetExcInfo (#103157)

kumaraditya303 webhook-mailer at python.org
Sat Apr 1 01:01:55 EDT 2023


https://github.com/python/cpython/commit/848bdbe166b71ab2ac2c0c1d88432fb995d1444c
commit: 848bdbe166b71ab2ac2c0c1d88432fb995d1444c
branch: main
author: Irit Katriel <1055913+iritkatriel at users.noreply.github.com>
committer: kumaraditya303 <59607654+kumaraditya303 at users.noreply.github.com>
date: 2023-04-01T10:31:48+05:30
summary:

gh-102192: use PyErr_SetHandledException instead of the legacy PyErr_SetExcInfo (#103157)

files:
M Python/bytecodes.c
M Python/generated_cases.c.h

diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index 825fa705a4cd..617b6f311e2f 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -1842,7 +1842,7 @@ dummy_func(
             ERROR_IF(match == NULL, error);
 
             if (!Py_IsNone(match)) {
-                PyErr_SetExcInfo(NULL, Py_NewRef(match), NULL);
+                PyErr_SetHandledException(match);
             }
         }
 
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h
index 6bb37d69cc07..7df585be0bef 100644
--- a/Python/generated_cases.c.h
+++ b/Python/generated_cases.c.h
@@ -2591,7 +2591,7 @@
             if (match == NULL) goto pop_2_error;
 
             if (!Py_IsNone(match)) {
-                PyErr_SetExcInfo(NULL, Py_NewRef(match), NULL);
+                PyErr_SetHandledException(match);
             }
             #line 2597 "Python/generated_cases.c.h"
             stack_pointer[-1] = match;



More information about the Python-checkins mailing list