Skip to content

Commit 9b431af

Browse files
committed
address review: +use Py_BuildValue
1 parent c69d405 commit 9b431af

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

Modules/_testcapi/complex.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,22 +102,16 @@ _py_c_neg(PyObject *Py_UNUSED(module), PyObject *num)
102102
static PyObject * \
103103
_py_c_##suffix(PyObject *Py_UNUSED(module), PyObject *args) \
104104
{ \
105-
Py_complex num, exp; \
105+
Py_complex num, exp, res; \
106106
PyObject *res; \
107107
\
108108
if (!PyArg_ParseTuple(args, "DD", &num, &exp)) { \
109109
return NULL; \
110110
} \
111111
\
112112
errno = 0; \
113-
num = _Py_c_##suffix(num, exp); \
114-
\
115-
res = PyComplex_FromCComplex(num); \
116-
if (!res) { \
117-
return NULL; \
118-
} \
119-
\
120-
return Py_BuildValue("Ni", res, errno); \
113+
res = _Py_c_##suffix(num, exp); \
114+
return Py_BuildValue("Di", res, errno); \
121115
};
122116

123117
_PY_C_FUNC2(sum)

0 commit comments

Comments
 (0)