summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2020-09-02 20:22:15 (GMT)
committerdgp <dgp@users.sourceforge.net>2020-09-02 20:22:15 (GMT)
commit712f88bef73db43ea3e8169d8c5609ec420b3bf2 (patch)
treefa06dc169be56e3e15b3333290345f8532cb0065
parentee7073e46860e7e4746d0f8d68a8b66e708eb763 (diff)
downloadtcl-712f88bef73db43ea3e8169d8c5609ec420b3bf2.zip
tcl-712f88bef73db43ea3e8169d8c5609ec420b3bf2.tar.gz
tcl-712f88bef73db43ea3e8169d8c5609ec420b3bf2.tar.bz2
Fix for test lindex-18.0
-rw-r--r--generic/tclExecute.c20
-rw-r--r--generic/tclUtil.c17
2 files changed, 21 insertions, 16 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 70ed54a..890ce08 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -4857,13 +4857,19 @@ TEBCresume(
*/
if ((TclListObjGetElements(interp, valuePtr, &objc, &objv) == TCL_OK)
- && !TclHasIntRep(value2Ptr, &tclListType)
- && (TclGetIntForIndexM(NULL, value2Ptr, objc-1,
- &index) == TCL_OK)) {
- TclDecrRefCount(value2Ptr);
- tosPtr--;
- pcAdjustment = 1;
- goto lindexFastPath;
+ && !TclHasIntRep(value2Ptr, &tclListType)) {
+ int code;
+
+ DECACHE_STACK_INFO();
+ code = TclGetIntForIndexM(interp, value2Ptr, objc-1, &index);
+ CACHE_STACK_INFO();
+ if (code == TCL_OK) {
+ TclDecrRefCount(value2Ptr);
+ tosPtr--;
+ pcAdjustment = 1;
+ goto lindexFastPath;
+ }
+ Tcl_ResetResult(interp);
}
objResultPtr = TclLindexList(interp, valuePtr, value2Ptr);
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index 5b296f0..8db6606 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -3817,7 +3817,7 @@ GetEndOffsetFromObj(
if ((t1 == TCL_NUMBER_INT) && (t2 == TCL_NUMBER_INT)) {
/* Both are wide, do wide-integer math */
if (*opPtr == '-') {
- if ((w2 == WIDE_MIN) && (interp != NULL)) {
+ if (w2 == WIDE_MIN) {
goto extreme;
}
w2 = -w2;
@@ -3839,13 +3839,6 @@ GetEndOffsetFromObj(
offset = WIDE_MIN;
}
}
- } else if (interp == NULL) {
- /*
- * We use an interp to do bignum index calculations.
- * If we don't get one, call all indices with bignums errors,
- * and rely on callers to handle it.
- */
- goto parseError;
} else {
/*
* At least one is big, do bignum math. Little reason to
@@ -3856,7 +3849,13 @@ GetEndOffsetFromObj(
Tcl_Obj *sum;
extreme:
- Tcl_ExprObj(interp, objPtr, &sum);
+ if (interp) {
+ Tcl_ExprObj(interp, objPtr, &sum);
+ } else {
+ Tcl_Interp *compute = Tcl_CreateInterp();
+ Tcl_ExprObj(compute, objPtr, &sum);
+ Tcl_DeleteInterp(compute);
+ }
TclGetNumberFromObj(NULL, sum, &cd, &numType);
if (numType == TCL_NUMBER_INT) {