Tcl Source Code

Check-in [7ad9a0d2cb]
Login

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

Overview
Comment:An [array set] from a dict can only take shortcuts when the dict is "pure", that is, has no string rep.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-5-branch
Files: files | file ages | folders
SHA3-256: 7ad9a0d2cb0268518b0e5d4ad91f1cae713c1ba7c85ab8314c20a2590d4908a6
User & Date: dgp 2018-04-19 01:39:38
Context
2018-04-30
11:10
merge fix-1613456fff, closes [1613456fffffffff] and [27b682284974d0cd] check-in: 92c4bfbe32 user: sebres tags: core-8-5-branch
2018-04-19
01:41
merge 8.5 check-in: a376926d6e user: dgp tags: core-8-6-branch
01:39
An [array set] from a dict can only take shortcuts when the dict is "pure", that is, has no string r... check-in: 7ad9a0d2cb user: dgp tags: core-8-5-branch
2018-04-17
14:32
Restore build success to the TCL_REMOVE_OBSOLETE_TRACES configuration. check-in: b0e9d4fac9 user: dgp tags: core-8-5-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclVar.c.

3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
	goto ensureArray;
    }

    /*
     * Install the contents of the dictionary or list into the array.
     */

    if (arrayElemObj->typePtr == &tclDictType) {
	Tcl_Obj *keyPtr, *valuePtr;
	Tcl_DictSearch search;
	int done;

	if (Tcl_DictObjSize(interp, arrayElemObj, &done) != TCL_OK) {
	    return TCL_ERROR;
	}







|







3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
	goto ensureArray;
    }

    /*
     * Install the contents of the dictionary or list into the array.
     */

    if (arrayElemObj->typePtr == &tclDictType && arrayElemObj->bytes == NULL) {
	Tcl_Obj *keyPtr, *valuePtr;
	Tcl_DictSearch search;
	int done;

	if (Tcl_DictObjSize(interp, arrayElemObj, &done) != TCL_OK) {
	    return TCL_ERROR;
	}

Changes to tests/var.test.

757
758
759
760
761
762
763












764
765
766
767
768
769
770
	set elements {1 2 3 4}
	trace add variable a write "string length \$elements ;#"
	array set a $elements
    }
} -cleanup {
    unset -nocomplain ::a ::elements
} -result {}













test var-18.1 {array unset and unset traces: Bug 2939073} -setup {
    set already 0
    unset x
} -body {
    array set x {e 1 i 1}
    trace add variable x unset {apply {args {







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







757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
	set elements {1 2 3 4}
	trace add variable a write "string length \$elements ;#"
	array set a $elements
    }
} -cleanup {
    unset -nocomplain ::a ::elements
} -result {}
test var-17.2 {TclArraySet Dict shortcut only on pure value} -setup {
    unset -nocomplain a d
    set d {p 1 p 2}
    dict get $d p
    set foo 0
} -body {
    trace add variable a write "[list incr [namespace which -variable foo]];#"
    array set a $d
    set foo
} -cleanup {
    unset -nocomplain a d foo
} -result 2

test var-18.1 {array unset and unset traces: Bug 2939073} -setup {
    set already 0
    unset x
} -body {
    array set x {e 1 i 1}
    trace add variable x unset {apply {args {