Commit cf3d1087 authored by Guido van Rossum's avatar Guido van Rossum

Added PyComplex_AsCComplex

parent ff4af067
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment