From 45f13ef7d8a0aef737cb2f191f453e50591b6a17 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Fri, 23 Jul 2010 12:20:22 +0000 Subject: [PATCH] Fix calling Python function taking zero parameters. [SVN r64297] --- src/engine/src/compile.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/engine/src/compile.c b/src/engine/src/compile.c index a07e0d818..7a3f8d258 100644 --- a/src/engine/src/compile.c +++ b/src/engine/src/compile.c @@ -534,8 +534,15 @@ LIST * compile_rule( PARSE * parse, FRAME * frame ) inner->prev_user = frame->module->user_module ? frame : frame->prev_user; inner->module = frame->module; /* This gets fixed up in evaluate_rule(), below. */ inner->procedure = parse; - for ( p = parse->left; p; p = p->left ) - lol_add( inner->args, parse_evaluate( p->right, frame ) ); + /* Special-case LOL of length 1 where the first list is totally empty. + This is created when calling functions with no parameters, due to + the way jam grammar is written. This is OK when one jam function + calls another, but really not good when Jam function calls Python. */ + if ( parse->left->left == NULL && parse->left->right->func == compile_null) + ; + else + for ( p = parse->left; p; p = p->left ) + lol_add( inner->args, parse_evaluate( p->right, frame ) ); /* And invoke the rule. */ result = evaluate_rule( parse->string, inner );