Index: generic/nsf.c =================================================================== diff -u -r9bd2c31a189868ce6564005d7b5a7cf9e0dc81a5 -r2f921800dfd3c92bfa176f9d00f366bfc9341da1 --- generic/nsf.c (.../nsf.c) (revision 9bd2c31a189868ce6564005d7b5a7cf9e0dc81a5) +++ generic/nsf.c (.../nsf.c) (revision 2f921800dfd3c92bfa176f9d00f366bfc9341da1) @@ -16109,12 +16109,22 @@ paramPtr->paramObj = arg; INCR_REF_COUNT(paramPtr->paramObj); - result = Tcl_ListObjGetElements(interp, arg, &npac, &npav); + result = Tcl_ListObjGetElements(interp, paramPtr->paramObj, &npac, &npav); if (unlikely(result != TCL_OK || npac < 1 || npac > 2)) { + if (procNameObj != NULL) { + result = NsfPrintError(interp, + "wrong # of elements in parameter definition " + "of method '%s'. " + "Should be a list of 1 or 2 elements, but got: '$s'", + ObjStr(procNameObj), ObjStr(paramPtr->paramObj)); + } else { + result = NsfPrintError(interp, + "wrong # of elements in parameter definition. " + "Should be a list of 1 or 2 elements, but got: '%s'", + ObjStr(paramPtr->paramObj)); + } DECR_REF_COUNT(paramPtr->paramObj); - return NsfPrintError(interp, "wrong # of elements in parameter definition for method '%s'" - " (should be 1 or 2 list elements): %s", - ObjStr(procNameObj), ObjStr(arg)); + return result; } argString = ObjStr(npav[0]); Index: tests/info-variable.test =================================================================== diff -u -r275da34d3d7a874a451eced58242b738c8a37d1a -r2f921800dfd3c92bfa176f9d00f366bfc9341da1 --- tests/info-variable.test (.../info-variable.test) (revision 275da34d3d7a874a451eced58242b738c8a37d1a) +++ tests/info-variable.test (.../info-variable.test) (revision 2f921800dfd3c92bfa176f9d00f366bfc9341da1) @@ -51,6 +51,15 @@ #? {Person info parameter syntax age:integer} "/age/" #? {Person info parameter syntax -force:switch} "?-force?" #? {Person info parameter name "a b"} "a" + + set emsg [string cat \ + "wrong # of elements in parameter definition. " \ + "Should be a list of 1 or 2 elements, but got: ''"] + + foreach subcmd {default syntax type list name} { + ? [list nsf::parameter::info $subcmd ""] $emsg + } + ? {nsf::parameter::info syntax age:integer} "/age/" ? {nsf::parameter::info syntax -force:switch} "?-force?" ? {nsf::parameter::info name "a b"} "a"