Tcl Source Code

Check-in [f3fac8ede1]
Login
Bounty program for improvements to Tcl and certain Tcl packages.

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

Overview
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.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-5-branch
Files: files | file ages | folders
SHA1:f3fac8ede1a102dac5bb6c3f4d13586bb93b98ab
User & Date: dgp 2013-08-15 19:55:26
Context
2013-09-07
18:49
Partial revert of [a16752c252] bug fix to stop crashes in buggy tclcompiler. check-in: d7ad86353f user: dgp tags: core-8-5-branch
2013-09-05
17:21
Partial revert of [a16752c252] bug fix to stop crashes in buggy tclcompiler. Closed-Leaf check-in: cd9e4957c5 user: dgp tags: unbreak-tclcompiler
2013-08-29
20:08
Bump to 8.5.15 for release. check-in: c46e5e4d16 user: dgp tags: core-8-5-15-rc
2013-08-15
19:59
Make sure the errors raised by execution traces become errors raised by the traced command, as docum... check-in: 04da25f2f5 user: dgp tags: trunk
19:55
Make sure the errors raised by execution traces become errors raised by the traced command, as docum... check-in: f3fac8ede1 user: dgp tags: core-8-5-branch
2013-08-14
17:02
[a16752c252] Correct failure to call cmd deletion callbacks. check-in: 746ec0f768 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 {}}