From 5419f8e0ba508cfedb5c68a88aee618e25e17983 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 8 May 2019 18:06:23 +0000 Subject: For historical/hysterical reasons, the (unused??) public routines Tcl_UpVar() and Tcl_UpVar2() accept random garbage for a level argument (treat it as 1) while the [upvar] command has come to reject such values as bad levels. Add a test to call it to our attention if we ever change that disparity so we do so only on purpose. --- tests/upvar.test | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/upvar.test b/tests/upvar.test index 5ea870d..437f422 100644 --- a/tests/upvar.test +++ b/tests/upvar.test @@ -356,6 +356,10 @@ test upvar-8.11 {upvar will not create a variable that looks like an array} -set test upvar-9.1 {Tcl_UpVar2 procedure} testupvar { list [catch {testupvar xyz a {} x global} msg] $msg } {1 {bad level "xyz"}} +test upvar-9.1.1 {TclGetFrame, via Tcl_UpVar2} testupvar { + apply {{} {testupvar xyz a {} x local; set x foo}} + set a +} foo test upvar-9.2 {Tcl_UpVar2 procedure} testupvar { catch {unset a} catch {unset x} -- cgit v0.12