From 4744055aa075fc2557e4fe6148d10afa4ffc1451 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Fri, 8 Oct 2021 19:42:22 +0000 Subject: Fix for issue [a8579d906a28], "argument with no name". --- generic/tclProc.c | 2 +- tests/proc.test | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/generic/tclProc.c b/generic/tclProc.c index 769074b..642294c 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -497,7 +497,7 @@ TclCreateProc( "FORMALARGUMENTFORMAT", NULL); goto procError; } - if ((fieldCount == 0) || (fieldValues[0]->length == 0)) { + if ((fieldCount == 0) || (Tcl_GetCharLength(fieldValues[0]) == 0)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "argument with no name", -1)); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", diff --git a/tests/proc.test b/tests/proc.test index 4b539c4..a6409c8 100644 --- a/tests/proc.test +++ b/tests/proc.test @@ -324,6 +324,15 @@ test proc-4.8 {TclCreateProc, procbody obj, no leak on multiple iterations} -set test proc-4.9 {[39fed4dae5] Valid Tcl_PkgPresent return} procbodytest { procbodytest::check } 1 +test proc-4.10 { + TclCreateProc, issue a8579d906a28, argument with no name +} -body { + catch { + proc p1 [list [list [expr {1 + 2}] default]] {} + } +} -cleanup { + catch {rename p1 {}} +} -result 0 test proc-5.1 {Bytecompiling noop; test for correct argument substitution} -body { proc p args {} ; # this will be bytecompiled into t -- cgit v0.12