File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -1776,6 +1776,16 @@ Tcl_ListObjAppendList(
17761776    }
17771777
17781778    if  (elemCount  <= 0 ) {
1779+ 	/* 
1780+ 	 * Note that when elemCount <= 0, this routine is logically a 
1781+ 	 * no-op, removing and adding no elements to the list. However, by removing 
1782+ 	 * the string representation, we get the important side effect that the 
1783+ 	 * resulting listPtr is a list in canonical form. This is important. 
1784+ 	 * Resist any temptation to optimize this case further. See bug [e38dce74e2]. 
1785+ 	 */ 
1786+ 	if  (!ListObjIsCanonical (toObj )) {
1787+ 	    TclInvalidateStringRep (toObj );
1788+ 	}
17791789	/* Nothing to do. Note AFTER check for list above */ 
17801790	return  TCL_OK ;
17811791    }
Original file line number Diff line number Diff line change @@ -64,6 +64,16 @@ test list-1.30 {basic null treatment} {
6464    set e "\x00abc xyz"
6565    string equal $l $e
6666} 1
67+ test list-1.31 {bug [e38dce74e2]} {
68+     set l #foo
69+     set e {}
70+     list {*}$l {*}$e
71+ } {{#foo}}
72+ test list-1.32 {bug [e38dce74e2]} {
73+     set l " #foo"
74+     set e {}
75+     list {*}$l {*}$e
76+ } {{#foo}}
6777
6878# For the next round of tests create a list and then pick it apart
6979# with "index" to make sure that we get back exactly what went in.
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments