summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclTestObj.c11
-rw-r--r--tests/listObj.test4
2 files changed, 15 insertions, 0 deletions
diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c
index 37286e3..8597bbc 100644
--- a/generic/tclTestObj.c
+++ b/generic/tclTestObj.c
@@ -925,6 +925,17 @@ TestobjCmd(
}
SetVarToObj(destIndex, varPtr[varIndex]);
Tcl_SetObjResult(interp, varPtr[destIndex]);
+ } else if (strcmp(subCmd, "bug3598580") == 0) {
+ Tcl_Obj *listObjPtr, *elemObjPtr;
+ if (objc != 2) {
+ goto wrongNumArgs;
+ }
+ elemObjPtr = Tcl_NewIntObj(123);
+ listObjPtr = Tcl_NewListObj(1, &elemObjPtr);
+ /* Replace the single list element through itself, nonsense but legal. */
+ Tcl_ListObjReplace(interp, listObjPtr, 0, 1, 1, &elemObjPtr);
+ Tcl_SetObjResult(interp, listObjPtr);
+ return TCL_OK;
} else if (strcmp(subCmd, "convert") == 0) {
char *typeName;
if (objc != 4) {
diff --git a/tests/listObj.test b/tests/listObj.test
index 53017b1..9f9b41c 100644
--- a/tests/listObj.test
+++ b/tests/listObj.test
@@ -193,6 +193,10 @@ test listobj-10.1 {Bug [2971669]} {*}{
-result {{a b c d e} {} {a b c d e f}}
}
+test listobj-11.1 {bug 3598580} {
+ testobj bug3598580
+} 123
+
# cleanup
::tcltest::cleanupTests
return