TCL_EVAL_GLOBAL vs. [uplevel #0]
Closed / Fixed1439836fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 21 years ago
Descriptionplain2006-02-27 19:21:19
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}
dgpplain2006-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}
dgpplain2006-02-28 05:45:49
Logged In: YES user_id=80530 here's a patch with the tests and the fix.
dgpplain2006-02-28 05:45:50
File Added - 169072: 1439836.patch
dgpplain2006-02-28 06:49:11
File Deleted - 169072: File Added - 169080: 1439836.patch Logged In: YES user_id=80530 revised patch
dgpplain2006-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
dgpplain2006-02-28 22:49:45
Logged In: YES user_id=80530 Patches committed. Bug fixed for 8.4.13 and 8.5a4.
Log in (anonymous is fine) to add a comment.
Attachments:
- 1439836-85.patch [download] added by dgp on 2006-02-28 06:56:21. [details]
- 1439836.patch [download] added by dgp on 2006-02-28 06:49:11. [details]