]> granicus.if.org Git - python/commitdiff
Py_BuildValue(): Add "D" conversion to create a Python complex value from
authorFred Drake <fdrake@acm.org>
Mon, 12 Mar 2001 21:03:26 +0000 (21:03 +0000)
committerFred Drake <fdrake@acm.org>
Mon, 12 Mar 2001 21:03:26 +0000 (21:03 +0000)
    a Py_complex C value.

Patch by Walter Dörwald.
This partially closes SF patch #407148.

Python/modsupport.c

index ef36d108f5b7085021f6932c837bbacbea3a6fc3..08685898da222abc3bb06f06a92595661eb2df78 100644 (file)
@@ -286,6 +286,12 @@ do_mkvalue(char **p_format, va_list *p_va)
                        return PyFloat_FromDouble(
                                (double)va_arg(*p_va, va_double));
 
+#ifndef WITHOUT_COMPLEX
+               case 'D':
+                       return PyComplex_FromCComplex(
+                               *((Py_complex *)va_arg(*p_va, Py_complex *)));
+#endif /* WITHOUT_COMPLEX */
+
                case 'c':
                {
                        char p[1];