Added PyComplex_AsCComplex

This commit is contained in:
Guido van Rossum 1996-01-12 01:21:14 +00:00
parent ff4af06735
commit cf3d1087d1
1 changed files with 12 additions and 0 deletions

View File

@ -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;