From: Victor Stinner Date: Wed, 29 Sep 2021 23:28:10 +0000 (+0200) Subject: bpo-43753: _operator.is_() uses Py_Is() (GH-28641) X-Git-Tag: v3.11.0a1~41 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8d3e7eff0936926554db6162c992af5829dc8160;p=thirdparty%2FPython%2Fcpython.git bpo-43753: _operator.is_() uses Py_Is() (GH-28641) --- diff --git a/Modules/_operator.c b/Modules/_operator.c index 12a5bf6371b4..b3a8bef2eaed 100644 --- a/Modules/_operator.c +++ b/Modules/_operator.c @@ -704,10 +704,8 @@ static PyObject * _operator_is__impl(PyObject *module, PyObject *a, PyObject *b) /*[clinic end generated code: output=bcd47a402e482e1d input=5fa9b97df03c427f]*/ { - PyObject *result; - result = (a == b) ? Py_True : Py_False; - Py_INCREF(result); - return result; + PyObject *result = Py_Is(a, b) ? Py_True : Py_False; + return Py_NewRef(result); } /*[clinic input]