From 471091f55ae64b4d82644288198e183d8a1865c5 Mon Sep 17 00:00:00 2001 From: sebres Date: Mon, 17 Feb 2020 14:50:45 +0000 Subject: windows: avoid create of legacy error-vars on init phase (in fresh created interpreter) - no tcl_pkgPath variable on windows --- library/init.tcl | 4 ++-- tests/init.test | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/library/init.tcl b/library/init.tcl index eb6b04e..0a5e71b 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -57,13 +57,13 @@ namespace eval tcl { if {$Dir ni $::auto_path} { lappend ::auto_path $Dir } - catch { + if {[info exists ::tcl_pkgPath]} { catch { foreach Dir $::tcl_pkgPath { if {$Dir ni $::auto_path} { lappend ::auto_path $Dir } } - } + }} if {![interp issafe]} { variable Path [encoding dirs] diff --git a/tests/init.test b/tests/init.test index 07270e1..d56c72d 100644 --- a/tests/init.test +++ b/tests/init.test @@ -18,6 +18,19 @@ if {[lsearch [namespace children] ::tcltest] == -1} { # Clear out any namespaces called test_ns_* catch {namespace delete {*}[namespace children :: test_ns_*]} +test init-0.1 {no error on initialization phase (init.tcl)} -setup { + interp create slave +} -body { + slave eval { + list [set v [info exists ::errorInfo]] \ + [if {$v} {set ::errorInfo}] \ + [set v [info exists ::errorCode]] \ + [if {$v} {set ::errorCode}] + } +} -cleanup { + interp delete slave +} -result {0 {} 0 {}} + # Six cases - white box testing test init-1.1 {auto_qualify - absolute cmd - namespace} { -- cgit v0.12