From e3f5e21f00d98dacf701c346899ada0ef3327513 Mon Sep 17 00:00:00 2001 From: Miguel Sofer Date: Sat, 19 Dec 2009 14:21:59 +0000 Subject: * generic/tclBasic.c: Fix for bad cmd resolution by coroutines * tests/coroutine.test: [Bug #2917627]. Thanks to schelte for finding it. --- ChangeLog | 6 ++++++ generic/tclBasic.c | 3 ++- tests/coroutine.test | 12 +++++++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c62b2ac..6da4eb7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-12-19 Miguel Sofer + + * generic/tclBasic.c: Fix for bad cmd resolution by coroutines + * tests/coroutine.test: [Bug #2917627]. Thanks to schelte for + finding it. + 2009-12-16 Donal K. Fellows * library/safe.tcl (::safe::AliasGlob): Upgrade to correctly support a diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 1d649a1..aecdfa0 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -16,7 +16,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclBasic.c,v 1.435 2009/12/13 17:54:05 msofer Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.436 2009/12/19 14:22:00 msofer Exp $ */ #include "tclInt.h" @@ -8869,6 +8869,7 @@ TclNRCoroutineObjCmd( TclNRAddCallback(interp, NRCoroutineExitCallback, corPtr, NULL, NULL, NULL); iPtr->evalFlags |= TCL_EVAL_REDIRECT; + iPtr->lookupNsPtr = iPtr->varFramePtr->nsPtr; TclNREvalObjEx(interp, cmdObjPtr, 0, NULL, 0); return TCL_OK; diff --git a/tests/coroutine.test b/tests/coroutine.test index 639fc0b..b4019d4 100644 --- a/tests/coroutine.test +++ b/tests/coroutine.test @@ -9,7 +9,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: coroutine.test,v 1.9 2009/12/07 20:49:29 msofer Exp $ +# RCS: @(#) $Id: coroutine.test,v 1.10 2009/12/19 14:22:00 msofer Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -402,6 +402,16 @@ test coroutine-4.3 {bug #2093947} -setup { unset ::res } -result {{v {} write} {v {} write} {v {} unset} {v {} write} {v {} unset}} +test coroutine-4.4 {bug #2917627: cmd resolution} -setup { + proc a {} {return global} + namespace eval b {proc a {} {return local}} +} -body { + namespace eval b {coroutine foo a} +} -cleanup { + rename a {} + namespace delete b +} -result local + test coroutine-5.1 {right numLevels on coro return} -constraints {testnrelevels} \ -setup { proc nestedYield {{val {}}} { -- cgit v0.12