Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2007-11-17
22:01 • Closed ticket [1833652fff]: absolute uplevel can fail when nested in relative up... artifact: 7738870ff8 user: msofer
14:37 • New ticket [1833652fff]. artifact: ffeb46379a user: mistachkin

absolute uplevel can fail when nested in relative uplevel

Closed / Invalid1833652fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 19 years ago
Descriptionplain2007-11-17 14:37:53
NOTE: This bug applies to both 8.4.x and HEAD.

proc a { a } {
  puts stdout [info level]; # 1
  b $a
}

proc b { b } {
  puts stdout [info level]; # 2

  uplevel 1 {
    puts stdout [info level]; # 1

    uplevel 1 {
      puts stdout [info level]; #0

      uplevel #0 {
        puts stdout [info level]; #0
      }

      uplevel #1 {
        # this raises an error when it should not.
        puts stdout [info level]; # 1
      }

      uplevel #2 {
        # this raises an error when it should not.
        puts stdout [info level]; # 2
      }
    }
  }
}

a 2
msoferplain2007-11-17 22:01:14
Logged In: YES 
user_id=148712
Originator: NO

That is the correct behaviour, per design and docs:
"The uplevel command causes the invoking procedure to disappear from the procedure calling stack while the command is being executed."
Log in (anonymous is fine) to add a comment.