diff options
-rw-r--r-- | generic/tclStringObj.c | 16 | ||||
-rw-r--r-- | tests/string.test | 15 |
2 files changed, 31 insertions, 0 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 0a38836..261e01f 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2966,9 +2966,25 @@ TclStringCatObjv( Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ if (numBytes == 0) { + if (pendingPtr && pendingPtr->bytes) { + /* + * Generating string rep of objPtr also + * generated string rep of pendingPtr. + */ + if (pendingPtr->length) { + /* Can this happen? */ + goto foo; + } else { + /* string-29.14 */ + first = objc - 1; + last = 0; + pendingPtr = NULL; + } + } continue; } last = objc - oc; +foo: if (pendingPtr) { Tcl_GetStringFromObj(pendingPtr, &length); /* PANIC? */ pendingPtr = NULL; diff --git a/tests/string.test b/tests/string.test index 9c43f29..7b02928 100644 --- a/tests/string.test +++ b/tests/string.test @@ -2024,6 +2024,21 @@ test string-29.13 {string cat, efficiency} -body { tcl::unsupported::representation [string cat \ [encoding convertto utf-8 {}] [encoding convertto utf-8 {}] [list x]] } -match glob -result {*, string representation "x"} +test string-29.14 {string cat, efficiency} -setup { + set e [encoding convertto utf-8 {}] +} -cleanup { + unset e +} -body { + tcl::unsupported::representation [string cat $e $e [list x]] +} -match glob -result {*no string representation} +test string-29.15 {string cat, efficiency} -setup { + set e [encoding convertto utf-8 {}] + set f [encoding convertto utf-8 {}] +} -cleanup { + unset e f +} -body { + tcl::unsupported::representation [string cat $e $f $e $f [list x]] +} -match glob -result {*no string representation} |