From d1fefb7ec79f96d245eb6d5c88159ca70251ccd2 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 24 Sep 2004 01:14:38 +0000 Subject: * generic/tclBasic.c: Corrections to the 2004-09-21 commit * generic/tclExecute.c: regarding ERR_ALREADY_LOGGED. That commit * generic/tclNamesp.c: caused Tk test send-10.7 to fail. Added * tests/namespace.test (25.7,8): tests in the Tcl test suite * tests/pkg.test (2.25,26): to catch this error without the aid of Tk in the future. --- ChangeLog | 7 +++++++ generic/tclBasic.c | 3 ++- generic/tclExecute.c | 3 ++- generic/tclNamesp.c | 3 +-- tests/namespace.test | 14 +++++++++++++- tests/pkg.test | 21 ++++++++++++++++++++- 6 files changed, 45 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index cddd0a0..170a1ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,13 @@ 2004-09-23 Don Porter + * generic/tclBasic.c: Corrections to the 2004-09-21 commit + * generic/tclExecute.c: regarding ERR_ALREADY_LOGGED. That commit + * generic/tclNamesp.c: caused Tk test send-10.7 to fail. Added + * tests/namespace.test (25.7,8): tests in the Tcl test suite + * tests/pkg.test (2.25,26): to catch this error without the + aid of Tk in the future. + * generic/tclCmdAH.c (Tcl_ExprObjCmd): Simplified the TclObjCmdProc of [expr] with a call to Tcl_ConcatObj. diff --git a/generic/tclBasic.c b/generic/tclBasic.c index aabcb27..e83da4f 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclBasic.c,v 1.115 2004/09/21 22:45:40 dgp Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.116 2004/09/24 01:14:41 dgp Exp $ */ #include "tclInt.h" @@ -3644,6 +3644,7 @@ Tcl_EvalEx(interp, script, numBytes, flags) } Tcl_LogCommandInfo(interp, script, parse.commandStart, commandLength); } + iPtr->flags &= ~ERR_ALREADY_LOGGED; for (i = 0; i < objectsUsed; i++) { Tcl_DecrRefCount(objv[i]); diff --git a/generic/tclExecute.c b/generic/tclExecute.c index a79ab92..138d25e 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -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: tclExecute.c,v 1.152 2004/09/22 15:48:22 msofer Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.153 2004/09/24 01:14:42 dgp Exp $ */ #ifdef STDC_HEADERS @@ -4829,6 +4829,7 @@ TclExecuteByteCode(interp, codePtr) CACHE_STACK_INFO(); } } + iPtr->flags &= ~ERR_ALREADY_LOGGED; /* * Clear all expansions that may have started after the last diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 902d5d6..abd179c 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -21,7 +21,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclNamesp.c,v 1.54 2004/09/21 22:45:42 dgp Exp $ + * RCS: @(#) $Id: tclNamesp.c,v 1.55 2004/09/24 01:14:43 dgp Exp $ */ #include "tclInt.h" @@ -515,7 +515,6 @@ Tcl_PopCallFrame(interp) } iPtr->flags |= saveErrFlag; - iPtr->flags &= ~ERR_ALREADY_LOGGED; /* * Decrement the namespace's count of active call frames. If the diff --git a/tests/namespace.test b/tests/namespace.test index 6338316..e11cfc6 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.37 2004/09/13 10:49:19 dkf Exp $ +# RCS: @(#) $Id: namespace.test,v 1.38 2004/09/24 01:14:43 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -950,6 +950,18 @@ test namespace-25.6 {NamespaceEvalCmd, error in eval'd script} { (in namespace eval "::test_ns_1" script line 1) invoked from within "namespace eval test_ns_1 {xxxx}"}} +test namespace-25.7 {NamespaceEvalCmd, error in eval'd script} { + list [catch {namespace eval test_ns_1 {error foo bar baz}} msg] $msg $errorInfo +} {1 foo {bar + (in namespace eval "::test_ns_1" script line 1) + invoked from within +"namespace eval test_ns_1 {error foo bar baz}"}} +test namespace-25.8 {NamespaceEvalCmd, error in eval'd script} { + list [catch {namespace eval test_ns_1 error foo bar baz} msg] $msg $errorInfo +} {1 foo {bar + (in namespace eval "::test_ns_1" script line 1) + invoked from within +"namespace eval test_ns_1 error foo bar baz"}} catch {unset v} test namespace-26.1 {NamespaceExportCmd, no args and new ns} { diff --git a/tests/pkg.test b/tests/pkg.test index 97235f9..7f3a9b5 100644 --- a/tests/pkg.test +++ b/tests/pkg.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: pkg.test,v 1.12 2004/05/19 12:56:01 dkf Exp $ +# RCS: @(#) $Id: pkg.test,v 1.13 2004/09/24 01:14:47 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -261,6 +261,25 @@ test pkg-2.24 {Tcl_PkgRequire procedure, version checks} { package provide t 2.3 list [catch {package require -exact t 2.2} msg] $msg } {1 {version conflict for package "t": have 2.3, need 2.2}} +test pkg-2.25 {Tcl_PkgRequire procedure, error in ifneeded script} { + package forget t + package ifneeded t 2.1 {package provide t 2.1; error "ifneeded test" EI} + list [catch {package require t 2.1} msg] $msg $errorInfo +} {1 {ifneeded test} {EI + ("package ifneeded" script) + invoked from within +"package require t 2.1"}} +test pkg-2.26 {Tcl_PkgRequire procedure, error in ifneeded script} { + package forget t + package ifneeded t 2.1 {package provide t 2.1; foreach x 1 {error "ifneeded test" EI}} + list [catch {package require t 2.1} msg] $msg $errorInfo +} {1 {ifneeded test} {EI + ("foreach" body line 1) + invoked from within +"foreach x 1 {error "ifneeded test" EI}" + ("package ifneeded" script) + invoked from within +"package require t 2.1"}} test pkg-3.1 {Tcl_PackageCmd procedure} { list [catch {package} msg] $msg -- cgit v0.12