Skip to content

Commit 93d22e5

Browse files
author
fdrake
committed
Py_BuildValue(): Add "D" conversion to create a Python complex value from a Py_complex C value. Patch by Walter Dörwald. This partially closes SF patch #407148. git-svn-id: http://svn.python.org/projects/python/trunk@19909 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent b366717 commit 93d22e5

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Python/modsupport.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,12 @@ do_mkvalue(char **p_format, va_list *p_va)
286286
return PyFloat_FromDouble(
287287
(double)va_arg(*p_va, va_double));
288288

289+
#ifndef WITHOUT_COMPLEX
290+
case 'D':
291+
return PyComplex_FromCComplex(
292+
*((Py_complex *)va_arg(*p_va, Py_complex *)));
293+
#endif /* WITHOUT_COMPLEX */
294+
289295
case 'c':
290296
{
291297
char p[1];

0 commit comments

Comments
 (0)