From c0fe0fb01cd4a52aca1ac071d98e7f78e96f5817 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 16 Oct 2008 16:08:09 +0000 Subject: * library/init.tcl: Revised [unknown] so that it carefully preserves the state of the ::errorInfo and ::errorCode variables at the start of auto-loading and restores that state before the autoloaded command is evaluated. [Bug 2140628] --- ChangeLog | 7 +++++++ library/init.tcl | 11 ++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index b2547c9..91b88c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-10-16 Don Porter + + * library/init.tcl: Revised [unknown] so that it carefully + preserves the state of the ::errorInfo and ::errorCode variables + at the start of auto-loading and restores that state before the + autoloaded command is evaluated. [Bug 2140628] + 2008-10-15 Jan Nijtmans * generic/tclInt.h: Add "const" to many internal diff --git a/library/init.tcl b/library/init.tcl index 9b04f64..4fae191 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -3,7 +3,7 @@ # Default system startup file for Tcl-based applications. Defines # "unknown" procedure and auto-load facilities. # -# RCS: @(#) $Id: init.tcl,v 1.113 2008/10/14 20:08:21 dgp Exp $ +# RCS: @(#) $Id: init.tcl,v 1.114 2008/10/16 16:08:09 dgp Exp $ # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. @@ -262,8 +262,13 @@ proc unknown args { unset UnknownPending } if {$msg} { - catch {set ::errorCode $savedErrorCode} - catch {set ::errorInfo $savedErrorInfo} + unset -nocomplain ::errorCode ::errorInfo + if {[info exists savedErrorCode]} { + set ::errorCode $savedErrorCode + } + if {[info exists savedErrorInfo]} { + set ::errorInfo $savedErrorInfo + } set code [catch {uplevel 1 $args} msg opts] if {$code == 1} { # -- cgit v0.12