diff options
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r-- | generic/tclStringObj.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 64c661b..040c287 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -483,6 +483,17 @@ Tcl_GetCharLength( return length; } + if ((objPtr->typePtr == &tclDictType) + || (objPtr->typePtr == &tclListType)) { + List *list = objPtr->internalRep.twoPtrValue.ptr1; + if (list->numChars == -1) { + (void) TclGetString(objPtr); + TclNumUtfChars(numChars, objPtr->bytes, objPtr->length); + list->numChars = numChars; + } + return list->numChars; + } + /* * OK, need to work with the object as a string. */ |