diff options
author | Guido van Rossum <guido@python.org> | 1995-01-20 16:56:02 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1995-01-20 16:56:02 (GMT) |
commit | d1b9393ba5e6dc24d147235c3a78f54bf5ef4a52 (patch) | |
tree | 6523e08fc54ebff49f84b3652427c390122bcdaf /Python | |
parent | 1919ca7b2850f7db6d4af4c90ac343564a007843 (diff) | |
download | cpython-d1b9393ba5e6dc24d147235c3a78f54bf5ef4a52.zip cpython-d1b9393ba5e6dc24d147235c3a78f54bf5ef4a52.tar.gz cpython-d1b9393ba5e6dc24d147235c3a78f54bf5ef4a52.tar.bz2 |
support "O&" taking an object constructor a void*
Diffstat (limited to 'Python')
-rw-r--r-- | Python/modsupport.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Python/modsupport.c b/Python/modsupport.c index 71bbf6c..518d433 100644 --- a/Python/modsupport.c +++ b/Python/modsupport.c @@ -110,6 +110,7 @@ static int countformat(format, endchar) level--; break; case '#': + case '&': case ',': case ':': case ' ': @@ -268,7 +269,7 @@ do_mkvalue(p_format, p_va) case 'f': case 'd': - return newfloatobject((double)va_arg(*p_va, double)); + return newfloatobject((double)va_arg(*p_va, va_double)); case 'c': { @@ -303,7 +304,14 @@ do_mkvalue(p_format, p_va) case 'S': case 'O': - { + if (**p_format == '&') { + typedef object *(*converter)(void *); + converter func = va_arg(*p_va, converter); + void *arg = va_arg(*p_va, void *); + ++*p_format; + return (*func)(arg); + } + else { object *v; v = va_arg(*p_va, object *); if (v != NULL) |