summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2024-03-04 13:31:25 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2024-03-04 13:31:25 (GMT)
commit65cf4531a3d2d7d40b37d1cc4cda45bf80678b27 (patch)
tree410f2c500eb3a68d03dc419e1c2425ea153ba35e /library
parent589a1466ada60174ddd4ff2bec13d41f190fd3ac (diff)
parent3910fc59f08f55b33bbfee6ca8a7fa489019f677 (diff)
downloadtcl-65cf4531a3d2d7d40b37d1cc4cda45bf80678b27.zip
tcl-65cf4531a3d2d7d40b37d1cc4cda45bf80678b27.tar.gz
tcl-65cf4531a3d2d7d40b37d1cc4cda45bf80678b27.tar.bz2
Merge 8.6
Diffstat (limited to 'library')
-rw-r--r--library/init.tcl32
-rw-r--r--library/msgcat/msgcat.tcl2
2 files changed, 18 insertions, 16 deletions
diff --git a/library/init.tcl b/library/init.tcl
index 5d8e55d..cffe951 100644
--- a/library/init.tcl
+++ b/library/init.tcl
@@ -52,6 +52,7 @@ if {![info exists auto_path]} {
set auto_path ""
}
}
+
namespace eval tcl {
if {![interp issafe]} {
variable Dir
@@ -355,16 +356,20 @@ proc unknown args {
proc auto_load {cmd {namespace {}}} {
global auto_index auto_path
+ # qualify names:
if {$namespace eq ""} {
set namespace [uplevel 1 [list ::namespace current]]
}
set nameList [auto_qualify $cmd $namespace]
# workaround non canonical auto_index entries that might be around
# from older auto_mkindex versions
- lappend nameList $cmd
- foreach name $nameList {
+ if {$cmd ni $nameList} {lappend nameList $cmd}
+
+ # try to load (and create sub-cmd handler "_sub_load_cmd" for further usage):
+ foreach name $nameList [set _sub_load_cmd {
+ # via auto_index:
if {[info exists auto_index($name)]} {
- namespace eval :: $auto_index($name)
+ namespace inscope :: $auto_index($name)
# There's a couple of ways to look for a command of a given
# name. One is to use
# info commands $name
@@ -376,22 +381,19 @@ proc auto_load {cmd {namespace {}}} {
return 1
}
}
- }
+ }]
+
+ # load auto_index if possible:
if {![info exists auto_path]} {
return 0
}
-
if {![auto_load_index]} {
return 0
}
- foreach name $nameList {
- if {[info exists auto_index($name)]} {
- namespace eval :: $auto_index($name)
- if {[namespace which -command $name] ne ""} {
- return 1
- }
- }
- }
+
+ # try again (something new could be loaded):
+ foreach name $nameList $_sub_load_cmd
+
return 0
}
@@ -558,7 +560,7 @@ proc auto_import {pattern} {
foreach name [array names auto_index $pattern] {
if {([namespace which -command $name] eq "")
&& ([namespace qualifiers $pattern] eq [namespace qualifiers $name])} {
- namespace eval :: $auto_index($name)
+ namespace inscope :: $auto_index($name)
}
}
}
@@ -621,7 +623,7 @@ proc auto_execok name {
return ""
}
- set path "[file dirname [info nameof]];.;"
+ set path "[file dirname [info nameofexecutable]];.;"
if {[info exists env(SystemRoot)]} {
set windir $env(SystemRoot)
} elseif {[info exists env(WINDIR)]} {
diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl
index 589da7a..f6e5224 100644
--- a/library/msgcat/msgcat.tcl
+++ b/library/msgcat/msgcat.tcl
@@ -1221,7 +1221,7 @@ proc msgcat::mcutil::ConvertLocale {value} {
# - called from a classless oo object
proc ::msgcat::PackageNamespaceGet {} {
set ns [uplevel 2 { namespace current }]
-
+
if {![string match {::oo::*} $ns]} {
# Not in object environment
return $ns