]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-43753: _operator.is_() uses Py_Is() (GH-28641)
authorVictor Stinner <vstinner@python.org>
Wed, 29 Sep 2021 23:28:10 +0000 (01:28 +0200)
committerGitHub <noreply@github.com>
Wed, 29 Sep 2021 23:28:10 +0000 (01:28 +0200)
Modules/_operator.c

index 12a5bf6371b459a69157d8c13e6f4cc0a121ebf3..b3a8bef2eaedd98eacb9bcee076cee86aed78129 100644 (file)
@@ -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]