From c13a4e60c7fd67ee9c912bb806389393cb802487 Mon Sep 17 00:00:00 2001 From: hikariyo <61240774+hikariyo@users.noreply.github.com> Date: Tue, 15 Oct 2024 01:16:22 +0800 Subject: [PATCH] Complete what #125044 did --- Objects/longobject.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Objects/longobject.c b/Objects/longobject.c index 4e948940485730..4a07f1e167df04 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -5003,9 +5003,7 @@ long_pow(PyObject *v, PyObject *w, PyObject *x) /* At this point a, b, and c are guaranteed non-negative UNLESS c is NULL, in which case a may be negative. */ - z = (PyLongObject *)PyLong_FromLong(1L); - if (z == NULL) - goto Error; + z = (PyLongObject *)Py_NewRef(_PyLong_GetOne()); /* Perform a modular reduction, X = X % c, but leave X alone if c * is NULL.