summaryrefslogtreecommitdiffstats
path: root/generic/tclUtil.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2018-11-13 21:10:33 (GMT)
committerdgp <dgp@users.sourceforge.net>2018-11-13 21:10:33 (GMT)
commit3e8ffff6a3663495e9cbc3fe5eb0dd1798904dbe (patch)
treeffc9422e6e57f2706528cb9e780a54717f2089a6 /generic/tclUtil.c
parentad8c23540cd977b9e923053d0e86a56207761680 (diff)
downloadtcl-3e8ffff6a3663495e9cbc3fe5eb0dd1798904dbe.zip
tcl-3e8ffff6a3663495e9cbc3fe5eb0dd1798904dbe.tar.gz
tcl-3e8ffff6a3663495e9cbc3fe5eb0dd1798904dbe.tar.bz2
[35a8f1c04a] Fix bad lengths when creating string rep of some lists.
Diffstat (limited to 'generic/tclUtil.c')
-rw-r--r--generic/tclUtil.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index ea2c7a9..812bcad 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -1044,6 +1044,23 @@ TclScanElement(
return 2;
}
+#if COMPAT
+ /*
+ * We have an established history in TclConvertElement() when quoting
+ * because of a leading hash character to force what would be the
+ * CONVERT_MASK mode into the CONVERT_BRACE mode. That is, we format
+ * the element #{a"b} like this:
+ * {#{a"b}}
+ * and not like this:
+ * \#{a\"b}
+ * This is inconsistent with [list x{a"b}], but we will not change that now.
+ * Set that preference here so that we compute a tight size requirement.
+ */
+ if ((*src == '#') && !(*flagPtr & TCL_DONT_QUOTE_HASH)) {
+ preferBrace = 1;
+ }
+#endif
+
if ((*p == '{') || (*p == '"')) {
/*
* Must escape or protect so leading character of value is not