mirror of https://github.com/python/cpython.git
Added PyComplex_AsCComplex
This commit is contained in:
parent
ff4af06735
commit
cf3d1087d1
|
@ -208,6 +208,18 @@ PyComplex_ImagAsDouble(PyObject *op) {
|
|||
}
|
||||
}
|
||||
|
||||
complex
|
||||
PyComplex_AsCComplex(PyObject *op) {
|
||||
complex cv;
|
||||
if (PyComplex_Check(op)) {
|
||||
return ((PyComplexObject *)op)->cval;
|
||||
} else {
|
||||
cv.real = PyFloat_AsDouble(op);
|
||||
cv.imag = 0.;
|
||||
return cv;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
complex_dealloc(op)
|
||||
object *op;
|
||||
|
|
Loading…
Reference in New Issue