File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -2007,14 +2007,11 @@ TclCompileRegexpCmd(
20072007 return TCL_ERROR ;
20082008 }
20092009
2010- if (len == 0 ) {
2011- /*
2012- * The semantics of regexp are always match on re == "".
2013- */
2014-
2015- PushStringLiteral (envPtr , "1" );
2016- return TCL_OK ;
2017- }
2010+ /*
2011+ * Note: do not optimize for len == 0, as error should be generated
2012+ * at runtime if operand is not a resolvable variable.
2013+ * Bug https://core.tcl-lang.org/tcl/info/cb03e57a7b24d22c
2014+ */
20182015
20192016 /*
20202017 * Attempt to convert pattern to glob. If successful, push the
Original file line number Diff line number Diff line change @@ -1199,6 +1199,11 @@ test regexp-27.12 {regsub -command representation smash} {
11991199 set s {list (.+)}
12001200 regsub -command $s {list list} $s
12011201} {(.+) {list list} list}
1202+
1203+ test regexp-28.1 {bug cb03e57a7b} -returnCodes error -body {
1204+ regexp {} $nosuchvar
1205+ } -result {can't read "nosuchvar": no such variable}
1206+
12021207
12031208# cleanup
12041209::tcltest::cleanupTests
You can’t perform that action at this time.
0 commit comments