Kaydet (Commit) d1b9393b authored tarafından Guido van Rossum's avatar Guido van Rossum

support "O&" taking an object constructor a void*

üst 1919ca7b
...@@ -110,6 +110,7 @@ static int countformat(format, endchar) ...@@ -110,6 +110,7 @@ static int countformat(format, endchar)
level--; level--;
break; break;
case '#': case '#':
case '&':
case ',': case ',':
case ':': case ':':
case ' ': case ' ':
...@@ -268,7 +269,7 @@ do_mkvalue(p_format, p_va) ...@@ -268,7 +269,7 @@ do_mkvalue(p_format, p_va)
case 'f': case 'f':
case 'd': case 'd':
return newfloatobject((double)va_arg(*p_va, double)); return newfloatobject((double)va_arg(*p_va, va_double));
case 'c': case 'c':
{ {
...@@ -303,7 +304,14 @@ do_mkvalue(p_format, p_va) ...@@ -303,7 +304,14 @@ do_mkvalue(p_format, p_va)
case 'S': case 'S':
case 'O': 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; object *v;
v = va_arg(*p_va, object *); v = va_arg(*p_va, object *);
if (v != NULL) if (v != NULL)
......
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