From fccedf819b4db35a8f3ba1fad4fcd25557b09799 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Tue, 6 Dec 2011 14:59:18 +0000 Subject: [PATCH] Don't pass an empty list to rules with no arguments. It breaks Python. [SVN r75824] --- src/engine/function.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/engine/function.c b/src/engine/function.c index 6a572372a..80dcf7c47 100644 --- a/src/engine/function.c +++ b/src/engine/function.c @@ -382,6 +382,7 @@ static LIST * function_call_rule( JAM_FUNCTION * function, FRAME * frame, STACK LIST * first = stack_pop( s ); LIST * result = L0; OBJECT * rulename; + LIST * trailing; frame->file = file; frame->line = line; @@ -420,14 +421,18 @@ static LIST * function_call_rule( JAM_FUNCTION * function, FRAME * frame, STACK stack_pop( s ); } - if ( inner->args->count == 0 ) + trailing = list_pop_front( first ); + if ( trailing ) { - lol_add( inner->args, list_pop_front( first ) ); - } - else - { - LIST * * l = &inner->args->list[0]; - *l = list_append( list_pop_front( first ), *l ); + if ( inner->args->count == 0 ) + { + lol_add( inner->args, trailing ); + } + else + { + LIST * * l = &inner->args->list[0]; + *l = list_append( trailing, *l ); + } } result = evaluate_rule( rulename, inner );