Tcl Source Code

View Ticket
Login
Ticket UUID: 1439836
Title: TCL_EVAL_GLOBAL vs. [uplevel #0]
Type: Bug Version: obsolete: 8.4.12
Submitter: dgp Created on: 2006-02-27 19:21:19
Subsystem: 45. Parsing and Eval Assigned To: dgp
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2006-02-28 22:49:45
Resolution: Fixed Closed By: dgp
    Closed on: 2006-02-28 15:49:45
Description:
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}
User Comments: dgp added on 2006-02-28 22:49:45:
Logged In: YES 
user_id=80530


Patches committed.  Bug fixed
for 8.4.13 and 8.5a4.

dgp added on 2006-02-28 06:56:21:

File Added - 169083: 1439836-85.patch

Logged In: YES 
user_id=80530


here's the corresponding patch
for the HEAD

dgp added on 2006-02-28 06:49:11:

File Deleted - 169072: 



File Added - 169080: 1439836.patch

Logged In: YES 
user_id=80530

revised patch

dgp added on 2006-02-28 05:45:50:

File Added - 169072: 1439836.patch

dgp added on 2006-02-28 05:45:49:
Logged In: YES 
user_id=80530


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

dgp added on 2006-02-28 03:03:11:
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}

Attachments: