summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2001-03-12 21:03:26 (GMT)
committerFred Drake <fdrake@acm.org>2001-03-12 21:03:26 (GMT)
commitaec79247b145e6cd5b7a769fd85ab71748d8b247 (patch)
tree0796157b229fc012bb52b2b233c8b57b059728fd
parent521c83dd80afa929816ced389d4f92a97815b978 (diff)
downloadcpython-aec79247b145e6cd5b7a769fd85ab71748d8b247.zip
cpython-aec79247b145e6cd5b7a769fd85ab71748d8b247.tar.gz
cpython-aec79247b145e6cd5b7a769fd85ab71748d8b247.tar.bz2
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.
-rw-r--r--Python/modsupport.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Python/modsupport.c b/Python/modsupport.c
index ef36d10..0868589 100644
--- a/Python/modsupport.c
+++ b/Python/modsupport.c
@@ -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];