summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Objects/complexobject.c
diff options
context:
space:
mode:
authorAlexSm <[email protected]>2024-02-16 11:51:30 +0100
committerGitHub <[email protected]>2024-02-16 11:51:30 +0100
commit506ecaee93b52cc12c2e2f97c3d42e3ca2a7f59e (patch)
treed096fb9eb988fbb0ca1ba970041773207ce3aa70 /contrib/tools/python3/src/Objects/complexobject.c
parent4749b9e5d260714490997e6f5ee1ee8c1c8fc46c (diff)
parentf200f72c9d7a89c1018e3dc6b46c49fe2ecf84fb (diff)
Merge pull request #1940 from dcherednik/importlib
Library import 14
Diffstat (limited to 'contrib/tools/python3/src/Objects/complexobject.c')
-rw-r--r--contrib/tools/python3/src/Objects/complexobject.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/contrib/tools/python3/src/Objects/complexobject.c b/contrib/tools/python3/src/Objects/complexobject.c
index 9bd68d50c30..aee03ddfb07 100644
--- a/contrib/tools/python3/src/Objects/complexobject.c
+++ b/contrib/tools/python3/src/Objects/complexobject.c
@@ -449,8 +449,7 @@ to_complex(PyObject **pobj, Py_complex *pc)
pc->real = PyFloat_AsDouble(obj);
return 0;
}
- Py_INCREF(Py_NotImplemented);
- *pobj = Py_NotImplemented;
+ *pobj = Py_NewRef(Py_NotImplemented);
return -1;
}
@@ -553,8 +552,7 @@ static PyObject *
complex_pos(PyComplexObject *v)
{
if (PyComplex_CheckExact(v)) {
- Py_INCREF(v);
- return (PyObject *)v;
+ return Py_NewRef(v);
}
else
return PyComplex_FromCComplex(v->cval);
@@ -631,8 +629,7 @@ complex_richcompare(PyObject *v, PyObject *w, int op)
else
res = Py_False;
- Py_INCREF(res);
- return res;
+ return Py_NewRef(res);
Unimplemented:
Py_RETURN_NOTIMPLEMENTED;
@@ -705,8 +702,7 @@ complex___complex___impl(PyComplexObject *self)
/*[clinic end generated code: output=e6b35ba3d275dc9c input=3589ada9d27db854]*/
{
if (PyComplex_CheckExact(self)) {
- Py_INCREF(self);
- return (PyObject *)self;
+ return Py_NewRef(self);
}
else {
return PyComplex_FromCComplex(self->cval);
@@ -917,8 +913,7 @@ complex_new_impl(PyTypeObject *type, PyObject *r, PyObject *i)
to exact complexes here. If either the input or the
output is a complex subclass, it will be handled below
as a non-orthogonal vector. */
- Py_INCREF(r);
- return r;
+ return Py_NewRef(r);
}
if (PyUnicode_Check(r)) {
if (i != NULL) {