summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--generic/tclNamesp.c5
-rw-r--r--tests/oo.test14
3 files changed, 19 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 31c69d2..7d495f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2009-01-29 Donal K. Fellows <dkf@users.sf.net>
+ * generic/tclNamesp.c (Tcl_FindCommand): [Bug 2519474]: Ensure that
+ the path is not searched when the TCL_NAMESPACE_ONLY flag is given.
+
* generic/tclOODecls.h (Tcl_OOInitStubs): [Bug 2537839]: Make the
declaration of this macro work correctly in the non-stub case.
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c
index 63c3d1f..42e5a2b 100644
--- a/generic/tclNamesp.c
+++ b/generic/tclNamesp.c
@@ -23,7 +23,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.187 2009/01/29 11:28:49 dkf Exp $
+ * RCS: @(#) $Id: tclNamesp.c,v 1.188 2009/01/29 15:57:54 dkf Exp $
*/
#include "tclInt.h"
@@ -2451,7 +2451,8 @@ Tcl_FindCommand(
*/
cmdPtr = NULL;
- if (cxtNsPtr->commandPathLength!=0 && strncmp(name, "::", 2)) {
+ if (cxtNsPtr->commandPathLength!=0 && strncmp(name, "::", 2)
+ && !(flags & TCL_NAMESPACE_ONLY)) {
int i;
Namespace *pathNsPtr, *realNsPtr, *dummyNsPtr;
diff --git a/tests/oo.test b/tests/oo.test
index 5db928e..e0b07b2 100644
--- a/tests/oo.test
+++ b/tests/oo.test
@@ -7,7 +7,7 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: oo.test,v 1.21 2009/01/27 11:11:47 dkf Exp $
+# RCS: @(#) $Id: oo.test,v 1.22 2009/01/29 15:57:54 dkf Exp $
package require TclOO 0.6.1 ;# Must match value in generic/tclOO.h
if {[lsearch [namespace children] ::tcltest] == -1} {
@@ -209,6 +209,18 @@ test oo-1.17 {basic test of OO functionality: Bug 2481109} -body {
} -cleanup {
namespace delete ::foo
} -result ::foo::lreplace
+# Check for Bug 2519474; problem in tclNamesp.c, but tested here...
+test oo-1.18 {OO: create object in NS with same name as global cmd} -setup {
+ proc test-oo-1.18 {} return
+ oo::class create A
+ oo::class create B {superclass A}
+} -body {
+ oo::define B constructor {} {A create test-oo-1.18}
+ B create C
+} -cleanup {
+ rename test-oo-1.18 {}
+ A destroy
+} -result ::C
test oo-2.1 {basic test of OO functionality: constructor} -setup {
# This is a bit complex because it needs to run in a sub-interp as