https://github.com/python/cpython/commit/8919cb4ad9fb18832a4bc9d5bbea305e9518c7ab
commit: 8919cb4ad9fb18832a4bc9d5bbea305e9518c7ab
branch: main
author: rialbat <47256826+rial...@users.noreply.github.com>
committer: vstinner <vstin...@python.org>
date: 2025-06-05T17:08:48+02:00
summary:

gh-135161: Remove redundant NULL check for 'exc' after dereference in ceval.c 
(#135162)

files:
M Python/ceval.c

diff --git a/Python/ceval.c b/Python/ceval.c
index 7aec196cb85704..5ea837e1a6ef31 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -3190,7 +3190,7 @@ _PyEval_FormatKwargsError(PyThreadState *tstate, PyObject 
*func, PyObject *kwarg
     else if (_PyErr_ExceptionMatches(tstate, PyExc_KeyError)) {
         PyObject *exc = _PyErr_GetRaisedException(tstate);
         PyObject *args = PyException_GetArgs(exc);
-        if (exc && PyTuple_Check(args) && PyTuple_GET_SIZE(args) == 1) {
+        if (PyTuple_Check(args) && PyTuple_GET_SIZE(args) == 1) {
             _PyErr_Clear(tstate);
             PyObject *funcstr = _PyObject_FunctionStr(func);
             if (funcstr != NULL) {

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: arch...@mail-archive.com

Reply via email to