From ad84c4a4fee745d25bfee2f61935452bb1f196c4 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Sat, 9 Dec 2023 06:43:53 +0300 Subject: [PATCH] Revert PyErr_ExceptionMatches --- Modules/mathmodule.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index 643560747e2f62..d930e7a7337e66 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -2231,6 +2231,8 @@ loghelper(PyObject* arg, double (*func)(double)) x = PyLong_AsDouble(arg); if (x == -1.0) { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; /* Here the conversion to double overflowed, but it's possible to compute the log anyway. Clear the exception and continue. */ PyErr_Clear();