Attachment "1480509.patch" to
ticket [1480509fff]
added by
dgp
2006-05-04 19:32:24.
Index: generic/tclExecute.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclExecute.c,v
retrieving revision 1.94.2.18
diff -u -r1.94.2.18 tclExecute.c
--- generic/tclExecute.c 12 Dec 2005 11:28:22 -0000 1.94.2.18
+++ generic/tclExecute.c 4 May 2006 12:26:27 -0000
@@ -5578,17 +5578,17 @@
}
if (Tcl_GetLongFromObj(NULL, valuePtr, &i) != TCL_OK) {
- /*
- * At this point, the only other possible type is double
- */
- Tcl_ResetResult(interp);
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
- "can't use floating-point value as argument to srand",
- (char *) NULL);
+ Tcl_WideInt w;
+
+ if (Tcl_GetWideIntFromObj(interp, valuePtr, &w) != TCL_OK) {
badValue:
- TclDecrRefCount(valuePtr);
- DECACHE_STACK_INFO();
- return TCL_ERROR;
+ Tcl_AddErrorInfo(interp, "\n (argument to \"srand()\")");
+ TclDecrRefCount(valuePtr);
+ DECACHE_STACK_INFO();
+ return TCL_ERROR;
+ }
+
+ i = Tcl_WideAsLong(w);
}
/*
Index: tests/expr-old.test
===================================================================
RCS file: /cvsroot/tcl/tcl/tests/expr-old.test,v
retrieving revision 1.16.2.4
diff -u -r1.16.2.4 expr-old.test
--- tests/expr-old.test 1 Nov 2005 16:18:16 -0000 1.16.2.4
+++ tests/expr-old.test 4 May 2006 12:26:28 -0000
@@ -811,7 +811,7 @@
} {1 {too few arguments for math function}}
test expr-old-32.48 {math functions in expressions} {
list [catch {expr srand(3.79)} msg] $msg
-} {1 {can't use floating-point value as argument to srand}}
+} {1 {expected integer but got "3.79"}}
test expr-old-32.49 {math functions in expressions} {
list [catch {expr srand("")} msg] $msg
} {1 {argument to math function didn't have numeric value}}