diff options
author | dgp <dgp@users.sourceforge.net> | 2004-09-30 22:45:10 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2004-09-30 22:45:10 (GMT) |
commit | 5c16366d01d19e9cacbb662827823e070bc606cf (patch) | |
tree | 6b2ec1f6f1ea65672138439c60138372dcf4414c /tests | |
parent | dd9bf5efaf27ae22d4c80c1e55bf79c422fb061c (diff) | |
download | tcl-5c16366d01d19e9cacbb662827823e070bc606cf.zip tcl-5c16366d01d19e9cacbb662827823e070bc606cf.tar.gz tcl-5c16366d01d19e9cacbb662827823e070bc606cf.tar.bz2 |
* generic/tclNamespace.c (TclTeardownNamespace): Tcl_Obj-ified
* tests/namespace.test (namespace-8.5,6): the save/restore
of ::errorInfo and ::errorCode during global namespace teardown.
Revised the comment to clarify why this is done, and added tests
that will fail if this is not done.
* generic/tclResult.c (TclTransferResult): Added safety
checks so that unexpected undefined ::errorInfo or ::errorCode
will not lead to a segfault.
* generic/tclVar.c (CallVarTraces): Save/restore the flag
* tests/var.test (var-16.1): values that define part of the
interpreter state during variable traces. [Bug 10381021].
Diffstat (limited to 'tests')
-rw-r--r-- | tests/namespace.test | 20 | ||||
-rw-r--r-- | tests/var.test | 9 |
2 files changed, 27 insertions, 2 deletions
diff --git a/tests/namespace.test b/tests/namespace.test index 1751eb5..daa6ecd 100644 --- a/tests/namespace.test +++ b/tests/namespace.test @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: namespace.test,v 1.21.2.2 2004/09/09 17:12:13 dgp Exp $ +# RCS: @(#) $Id: namespace.test,v 1.21.2.3 2004/09/30 22:45:17 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -193,6 +193,24 @@ test namespace-8.4 {TclTeardownNamespace, cmds imported from deleted ns go away} [namespace delete test_ns_export] \ [info commands test_ns_import::*] } [list [lsort {::test_ns_import::p ::test_ns_import::cmd1 ::test_ns_import::cmd2}] {} ::test_ns_import::p] +test namespace-8.5 {TclTeardownNamespace: preserve errorInfo; errorCode values} { + interp create slave + slave eval {trace add execution error leave {namespace delete :: ;#}} + catch {slave eval error foo bar baz} + interp delete slave + set ::errorInfo +} {bar + invoked from within +"slave eval error foo bar baz"} +test namespace-8.6 {TclTeardownNamespace: preserve errorInfo; errorCode values} { + interp create slave + slave eval {trace add variable errorCode write {namespace delete :: ;#}} + catch {slave eval error foo bar baz} + interp delete slave + set ::errorInfo +} {bar + invoked from within +"slave eval error foo bar baz"} test namespace-9.1 {Tcl_Import, empty import pattern} { catch {eval namespace delete [namespace children :: test_ns_*]} diff --git a/tests/var.test b/tests/var.test index 2f0c1df..64f52707 100644 --- a/tests/var.test +++ b/tests/var.test @@ -14,7 +14,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: var.test,v 1.20.2.2 2003/05/12 17:31:51 msofer Exp $ +# RCS: @(#) $Id: var.test,v 1.20.2.3 2004/09/30 22:45:17 dgp Exp $ # if {[lsearch [namespace children] ::tcltest] == -1} { @@ -694,6 +694,13 @@ test var-15.1 {segfault in [unset], [Bug 735335]} { namespace eval test unset useSomeUnlikelyNameHere } {} +test var-16.1 {CallVarTraces: save/restore interp error state: 1038021} { + trace add variable errorCode write { ;#} + catch {error foo bar baz} + trace remove variable errorCode write { ;#} + set errorInfo +} bar + catch {namespace delete ns} catch {unset arr} catch {unset v} |