diff options
author | nijtmans@users.sourceforge.net <jan.nijtmans> | 2013-02-26 10:15:44 (GMT) |
---|---|---|
committer | nijtmans@users.sourceforge.net <jan.nijtmans> | 2013-02-26 10:15:44 (GMT) |
commit | e7f376218ba7fc3b292806faf3b9aa25694000f8 (patch) | |
tree | a077eb5e7a9757d92149fd5bdaa372acb20c652c | |
parent | 9b6ff5e526baac15edcbe9f67cc80ba8131d6872 (diff) | |
download | tcl-e7f376218ba7fc3b292806faf3b9aa25694000f8.zip tcl-e7f376218ba7fc3b292806faf3b9aa25694000f8.tar.gz tcl-e7f376218ba7fc3b292806faf3b9aa25694000f8.tar.bz2 |
Don't panic if Tcl_ConvertToType is called for a type that doesn't have a setFromAnyProc, create a proper error message.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | generic/tclObj.c | 7 |
2 files changed, 11 insertions, 1 deletions
@@ -1,3 +1,8 @@ +2013-02-26 Jan Nijtmans <nijtmans@users.sf.net> + + * generic/tclObj.c: Don't panic if Tcl_ConvertToType is called for a + type that doesn't have a setFromAnyProc, create a proper error message. + 2013-02-25 Don Porter <dgp@users.sourceforge.net> * tests/assocd.test: [Bugs 3605719,3605720] Test independence. diff --git a/generic/tclObj.c b/generic/tclObj.c index e14c740..24b818b 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -993,7 +993,12 @@ Tcl_ConvertToType( */ if (typePtr->setFromAnyProc == NULL) { - Tcl_Panic("may not convert object to type %s", typePtr->name); + if (interp) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "can't convert value to type %s", typePtr->name)); + Tcl_SetErrorCode(interp, "TCL", "API_ABUSE", NULL); + } + return TCL_ERROR; } return typePtr->setFromAnyProc(interp, objPtr); |