#3375 TCL_EVAL_GLOBAL vs. [uplevel #0]

obsolete: 8.4.12
closed-fixed
Don Porter
5
2006-02-28
2006-02-27
Don Porter
No

The flag TCL_EVAL_GLOBAL ought to
have identical impact as [uplevel #0],
but these tests demo they are different
when exec traces are present:

test trace-21.9 {trace execution: TCL_EVAL_GLOBAL} {
trace add execution foo enter soom
proc ::soom args {lappend ::info SUCCESS [info level]}
set ::info {}
namespace eval test_ns_1 {
proc soom args {lappend ::info FAIL [info level]}
# [testevalobjv 1 ...] ought to produce the same
# results as [uplevel #0 ...].
testevalobjv 1 foo x
uplevel #0 foo x
}
namespace delete test_ns_1
trace remove execution foo enter soom
set ::info
} {SUCCESS 1 SUCCESS 1}

test trace-21.10 {trace execution: TCL_EVAL_GLOBAL} {
trace add execution foo leave soom
proc ::soom args {lappend ::info SUCCESS [info level]}
set ::info {}
namespace eval test_ns_1 {
proc soom args {lappend ::info FAIL [info level]}
# [testevalobjv 1 ...] ought to produce the same
# results as [uplevel #0 ...].
testevalobjv 1 foo x
uplevel #0 foo x
}
namespace delete test_ns_1
trace remove execution foo leave soom
set ::info
} {SUCCESS 1 SUCCESS 1}

Discussion

  • Don Porter
    Don Porter
    2006-02-27

    Logged In: YES
    user_id=80530

    This additional test demos
    similar trouble with [::unknown]:

    test parse-8.10 {Tcl_EvalObjv procedure, TCL_EVAL_GLOBAL}
    testevalobjv {
    rename ::unknown unknown.save
    proc ::unknown args {lappend ::info [info level]}
    catch {rename ::noSuchCommand {}}
    set ::info {}
    namespace eval test_ns_1 {
    testevalobjv 1 noSuchCommand
    uplevel #0 noSuchCommand
    }
    namespace delete test_ns_1
    rename ::unknown {}
    rename unknown.save ::unknown
    set ::info
    } {1 1}

     
  • Don Porter
    Don Porter
    2006-02-27

    • labels: --> 45. Parsing and Eval
    • milestone: --> obsolete: 8.4.12
    • assigned_to: nobody --> dgp
    • summary: exec trace: TCL_EVAL_GLOBAL vs. [uplevel #0] --> TCL_EVAL_GLOBAL vs. [uplevel #0]
     
  • Don Porter
    Don Porter
    2006-02-27

    Logged In: YES
    user_id=80530

    here's a patch with the
    tests and the fix.

     
  • Don Porter
    Don Porter
    2006-02-27

     
    Attachments
  • Don Porter
    Don Porter
    2006-02-27

    Logged In: YES
    user_id=80530

    revised patch

     
  • Don Porter
    Don Porter
    2006-02-27

    Logged In: YES
    user_id=80530

    here's the corresponding patch
    for the HEAD

     
  • Don Porter
    Don Porter
    2006-02-27

     
    Attachments
  • Don Porter
    Don Porter
    2006-02-28

    • status: open --> closed-fixed
     
  • Don Porter
    Don Porter
    2006-02-28

    Logged In: YES
    user_id=80530

    Patches committed. Bug fixed
    for 8.4.13 and 8.5a4.