summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2013-02-26 10:17:39 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2013-02-26 10:17:39 (GMT)
commit67d13bd63cda0688634601703ab45d349c9d68bf (patch)
tree94d8903a596524df0447b7aee4543abdc8000008
parent7a3e1077c416ced98e09783f5eefb09b1670a86e (diff)
parent9a1c42658beb9a46675417b8f4d5294ad8cbd66d (diff)
downloadtcl-67d13bd63cda0688634601703ab45d349c9d68bf.zip
tcl-67d13bd63cda0688634601703ab45d349c9d68bf.tar.gz
tcl-67d13bd63cda0688634601703ab45d349c9d68bf.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--ChangeLog5
-rw-r--r--generic/tclObj.c7
2 files changed, 11 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 117086f..2036b9c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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 Donal K. Fellows <dkf@users.sf.net>
* tests/binary.test (binary-41.*): [Bug 3605721]: Test independence
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);