summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2011-06-02 14:45:00 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2011-06-02 14:45:00 (GMT)
commitc64a4321a3facb02fef01af7f7384f8ef961ff4f (patch)
tree47d1bb6bee23c9563a20a7859d96bf43555bd593
parentc31b5e030892e09c7f5bdc8538ecc09b760bab3b (diff)
parent5d982178ea4904932de32a6331512d6db0174a91 (diff)
downloadtcl-c64a4321a3facb02fef01af7f7384f8ef961ff4f.zip
tcl-c64a4321a3facb02fef01af7f7384f8ef961ff4f.tar.gz
tcl-c64a4321a3facb02fef01af7f7384f8ef961ff4f.tar.bz2
[Bug 3185407]: Extend the set of epochs that are potentially bumped (in
TclInvalidateNsCmdLookup) when a command is created, for a slight performance drop (in some circumstances) and improved semantics.
-rw-r--r--ChangeLog9
-rw-r--r--generic/tclInt.h11
-rw-r--r--tests/namespace.test16
3 files changed, 31 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 78c78c0..2493519 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,13 @@
+2011-06-02 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tclInt.h (TclInvalidateNsCmdLookup): [Bug 3185407]: Extend
+ the set of epochs that are potentially bumped when a command is
+ created, for a slight performance drop (in some circumstances) and
+ improved semantics.
+
2011-06-01 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/tclUtil.c: fix for [Bug 3309871]: Valgrind finds:
+ * generic/tclUtil.c: Fix for [Bug 3309871]: Valgrind finds:
invalid read in TclMaxListLength()
2011-05-25 Don Porter <dgp@users.sourceforge.net>
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 1c1e615..d9b82d5 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -3727,8 +3727,8 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, CONST char *file,
*/
#define TclUtfToUniChar(str, chPtr) \
- ((((unsigned char) *(str)) < 0xC0) ? \
- ((*(chPtr) = (Tcl_UniChar) *(str)), 1) \
+ ((((unsigned char) *(str)) < 0xC0) ? \
+ ((*(chPtr) = (Tcl_UniChar) *(str)), 1) \
: Tcl_UtfToUniChar(str, chPtr))
/*
@@ -3759,8 +3759,11 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, CONST char *file,
*/
#define TclInvalidateNsCmdLookup(nsPtr) \
- if ((nsPtr)->numExportPatterns) { \
- (nsPtr)->exportLookupEpoch++; \
+ if ((nsPtr)->numExportPatterns) { \
+ (nsPtr)->exportLookupEpoch++; \
+ } \
+ if ((nsPtr)->commandPathLength) { \
+ (nsPtr)->cmdRefEpoch++; \
}
/*
diff --git a/tests/namespace.test b/tests/namespace.test
index 504d532..2be4cfc 100644
--- a/tests/namespace.test
+++ b/tests/namespace.test
@@ -2467,6 +2467,22 @@ test namespace-51.16 {Bug 1566526} {
slave eval namespace eval demo namespace path ::
interp delete slave
} {}
+test namespace-51.17 {Bug 3185407} -setup {
+ namespace eval ::test_ns_1 {}
+} -body {
+ namespace eval ::test_ns_1 {
+ variable result {}
+ namespace eval ns {proc foo {} {}}
+ namespace eval ns2 {proc foo {} {}}
+ namespace path {ns ns2}
+ variable x foo
+ lappend result [namespace which $x]
+ proc foo {} {}
+ lappend result [namespace which $x]
+ }
+} -cleanup {
+ namespace delete ::test_ns_1
+} -result {::test_ns_1::ns::foo ::test_ns_1::foo}
# TIP 181 - namespace unknown tests
test namespace-52.1 {unknown: default handler ::unknown} {