summaryrefslogtreecommitdiffstats
path: root/generic/tclAssembly.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclAssembly.c')
-rw-r--r--generic/tclAssembly.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c
index 02c64bd..a3fac8f 100644
--- a/generic/tclAssembly.c
+++ b/generic/tclAssembly.c
@@ -2258,8 +2258,13 @@ GetListIndexOperand(
Tcl_DecrRefCount(value);
/* Convert to an integer, advance to the next token and return. */
- status = TclGetIndexFromToken(tokenPtr, result, TCL_INDEX_OUT_OF_RANGE,
- TCL_INDEX_OUT_OF_RANGE);
+ /*
+ * NOTE: Indexing a list with an index before it yields the
+ * same result as indexing after it, and might be more easily portable
+ * when list size limits grow.
+ */
+ status = TclGetIndexFromToken(tokenPtr, result, TCL_INDEX_BEFORE,
+ TCL_INDEX_BEFORE);
*tokenPtrPtr = TokenAfter(tokenPtr);
if (status == TCL_ERROR && interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad index \"%.*s\"",