Tcl Source Code

Check-in [9198c16407]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix for [3592747]: Let TclNRTailcallEval handle namespace problems.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-6-branch
Files: files | file ages | folders
SHA3-256: 9198c16407f3f007592725e0cc69e17943ad87637788e6b1cf2c5a40441729f9
User & Date: pooryorick 2018-06-24 07:17:46
References
2018-08-13
12:53 Ticket [723a2f4ac3] return -code break/tailcall break from coroutine goes wrong at the top-level status still Pending with 3 other changes artifact: dd49020bd9 user: sebres
2018-06-24
07:24 Ticket [3592747fff] (tailcall|yieldto) failed to find the proper namespace Abort status still Open with 4 other changes artifact: 3b249618d7 user: pooryorick
Context
2018-06-25
07:22
Simplify ToUtf(), expecially for TCL_UTF_MAX>3 (with correct surrogate handling). Fix various typo's check-in: 257ff5d1b3 user: jan.nijtmans tags: core-8-6-branch
2018-06-24
07:17
Fix for [3592747]: Let TclNRTailcallEval handle namespace problems. check-in: 9198c16407 user: pooryorick tags: core-8-6-branch
2018-06-23
14:18
Add a test for no generation of a string representation when comparing with the empty string. check-in: b7e3852c22 user: pooryorick tags: core-8-6-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclBasic.c.

8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
     * command, then set it in the varFrame so that PopCallFrame can use it
     * at the proper time.
     */

    if (objc > 1) {
        Tcl_Obj *listPtr, *nsObjPtr;
        Tcl_Namespace *nsPtr = (Tcl_Namespace *) iPtr->varFramePtr->nsPtr;
        Tcl_Namespace *ns1Ptr;

        /* The tailcall data is in a Tcl list: the first element is the
         * namespace, the rest the command to be tailcalled. */

        listPtr = Tcl_NewListObj(objc, objv);

        nsObjPtr = Tcl_NewStringObj(nsPtr->fullName, -1);
        if ((TCL_OK != TclGetNamespaceFromObj(interp, nsObjPtr, &ns1Ptr))
                || (nsPtr != ns1Ptr)) {
            Tcl_Panic("Tailcall failed to find the proper namespace");
        }
 	TclListObjSetElement(interp, listPtr, 0, nsObjPtr);

        iPtr->varFramePtr->tailcallPtr = listPtr;
    }
    return TCL_RETURN;
}








<




<
<

<
|
<
<







8398
8399
8400
8401
8402
8403
8404

8405
8406
8407
8408


8409

8410


8411
8412
8413
8414
8415
8416
8417
     * command, then set it in the varFrame so that PopCallFrame can use it
     * at the proper time.
     */

    if (objc > 1) {
        Tcl_Obj *listPtr, *nsObjPtr;
        Tcl_Namespace *nsPtr = (Tcl_Namespace *) iPtr->varFramePtr->nsPtr;


        /* The tailcall data is in a Tcl list: the first element is the
         * namespace, the rest the command to be tailcalled. */



        nsObjPtr = Tcl_NewStringObj(nsPtr->fullName, -1);

        listPtr = Tcl_NewListObj(objc, objv);


 	TclListObjSetElement(interp, listPtr, 0, nsObjPtr);

        iPtr->varFramePtr->tailcallPtr = listPtr;
    }
    return TCL_RETURN;
}

Changes to tests/tailcall.test.

684
685
686
687
688
689
690




















691
692
693
694
695
696
} {0 ok NONE}

if {[testConstraint testnrelevels]} {
    namespace forget testnre::*
    namespace delete testnre
}





















# cleanup
::tcltest::cleanupTests

# Local Variables:
# mode: tcl
# End:







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>






684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
} {0 ok NONE}

if {[testConstraint testnrelevels]} {
    namespace forget testnre::*
    namespace delete testnre
}

test tailcall-14.1 {in a deleted namespace} -body {
    namespace eval ns {
	proc p args {
	    tailcall [namespace current] $args
	}
	namespace delete [namespace current]
	p
    }
} -returnCodes 1 -result {namespace "::ns" not found}

test tailcall-14.1-bc {{in a deleted namespace} {byte compiled}} -body {
    namespace eval ns {
	proc p args {
	    tailcall [namespace current] {*}$args
	}
	namespace delete [namespace current]
	p
    }
} -returnCodes 1 -result {namespace "::ns" not found}

# cleanup
::tcltest::cleanupTests

# Local Variables:
# mode: tcl
# End: