Check-in [f3fac8ede1]
Not logged in
Tcl 2015 Conference, Manassas/VA, US, Oct 19-23
Send your abstracts to tclconference@googlegroups.com by Aug 24.

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

Overview
SHA1 Hash:f3fac8ede1a102dac5bb6c3f4d13586bb93b98ab
Date: 2013-08-15 19:55:26
User: dgp
Comment:Make sure the errors raised by execution traces become errors raised by the traced command, as documented. Deletion of the traced command was supressing that.
Tags And Properties
Context
2013-09-07
18:49
[d7ad86353f] Partial revert of [a16752c252] bug fix to stop crashes in buggy tclcompiler. (user: dgp, tags: core-8-5-branch)
2013-09-05
17:21
[cd9e4957c5] Closed-Leaf: Partial revert of [a16752c252] bug fix to stop crashes in buggy tclcompiler. (user: dgp, tags: unbreak-tclcompiler)
2013-08-29
20:08
[c46e5e4d16] Bump to 8.5.15 for release. (user: dgp, tags: core-8-5-15-rc)
2013-08-15
19:59
[04da25f2f5] Make sure the errors raised by execution traces become errors raised by the traced command, as docum... (user: dgp, tags: trunk)
19:55
[f3fac8ede1] Make sure the errors raised by execution traces become errors raised by the traced command, as docum... (user: dgp, tags: core-8-5-branch)
2013-08-14
17:02
[746ec0f768] [a16752c252] Correct failure to call cmd deletion callbacks. (user: dgp, tags: core-8-5-branch)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclBasic.c.

3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
	 * If the traces modified/deleted the command or any existing traces,
	 * they will update the command's epoch. When that happens, set
	 * checkTraces is set to 0 to prevent the re-calling of traces (and
	 * any possible infinite loop) and we go back to re-find the command
	 * implementation.
	 */

	if (cmdEpoch != newEpoch) {
	    checkTraces = 0;
	    if (commandPtr) {
		Tcl_DecrRefCount(commandPtr);
		commandPtr = NULL;
	    }
	    goto reparseBecauseOfTraces;
	}







|







3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
	 * If the traces modified/deleted the command or any existing traces,
	 * they will update the command's epoch. When that happens, set
	 * checkTraces is set to 0 to prevent the re-calling of traces (and
	 * any possible infinite loop) and we go back to re-find the command
	 * implementation.
	 */

	if (traceCode == TCL_OK && cmdEpoch != newEpoch) {
	    checkTraces = 0;
	    if (commandPtr) {
		Tcl_DecrRefCount(commandPtr);
		commandPtr = NULL;
	    }
	    goto reparseBecauseOfTraces;
	}

Changes to tests/trace.test.

2654
2655
2656
2657
2658
2659
2660







2661
2662
2663
2664
2665
2666
2667

    list $::traceCalls | {*}$res
} -cleanup {
    unset ::traceLog ::traceCalls res
    rename dotrace {}
    rename foo {}
} -result {3 | 0 1 1}







    
# Delete procedures when done, so we don't clash with other tests
# (e.g. foobar will clash with 'unknown' tests).
catch {rename foobar {}}
catch {rename foo {}}
catch {rename bar {}}
catch {rename untraced {}}







>
>
>
>
>
>
>







2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674

    list $::traceCalls | {*}$res
} -cleanup {
    unset ::traceLog ::traceCalls res
    rename dotrace {}
    rename foo {}
} -result {3 | 0 1 1}

test trace-40.1 {execution trace errors become command errors} {
    proc foo args {}
    trace add execution foo enter {rename foo {}; error bar;#}
    catch foo m
    return -level 0 $m[unset m]
} bar
    
# Delete procedures when done, so we don't clash with other tests
# (e.g. foobar will clash with 'unknown' tests).
catch {rename foobar {}}
catch {rename foo {}}
catch {rename bar {}}
catch {rename untraced {}}