[Python-checkins] bpo-43753: _operator.is_() uses Py_Is() (GH-28641)

vstinner webhook-mailer at python.org
Wed Sep 29 19:28:18 EDT 2021


https://github.com/python/cpython/commit/8d3e7eff0936926554db6162c992af5829dc8160
commit: 8d3e7eff0936926554db6162c992af5829dc8160
branch: main
author: Victor Stinner <vstinner at python.org>
committer: vstinner <vstinner at python.org>
date: 2021-09-30T01:28:10+02:00
summary:

bpo-43753: _operator.is_() uses Py_Is() (GH-28641)

files:
M Modules/_operator.c

diff --git a/Modules/_operator.c b/Modules/_operator.c
index 12a5bf6371b45..b3a8bef2eaedd 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]



More information about the Python-checkins mailing list