diff options
author | jan.nijtmans <jan.nijtmans@noemail.net> | 2013-02-26 10:17:39 (GMT) |
---|---|---|
committer | jan.nijtmans <jan.nijtmans@noemail.net> | 2013-02-26 10:17:39 (GMT) |
commit | 7234fa2e7e449f1d7e32e9e50369ff3de1c1b644 (patch) | |
tree | 94d8903a596524df0447b7aee4543abdc8000008 /generic/tclObj.c | |
parent | 8e8472f26315031b686599670809cafac94d4920 (diff) | |
parent | 3e6e4927d42dcfebbf92370af71aa2df1784d844 (diff) | |
download | tcl-7234fa2e7e449f1d7e32e9e50369ff3de1c1b644.zip tcl-7234fa2e7e449f1d7e32e9e50369ff3de1c1b644.tar.gz tcl-7234fa2e7e449f1d7e32e9e50369ff3de1c1b644.tar.bz2 |
Don't panic if Tcl_ConvertToType is called for a type that doesn't have a setFromAnyProc, create a proper error message.
FossilOrigin-Name: d6219fccc2b017711a743b95e9fc0e6ff7691eba
Diffstat (limited to 'generic/tclObj.c')
-rw-r--r-- | generic/tclObj.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/generic/tclObj.c b/generic/tclObj.c index f2ec565..a40a29d 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -1005,7 +1005,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); |