compiled [dict append] and [dict lappend] broken
Closed / Fixed3079830fffffffffffffffffffffffffffffffffCreated 16 years agoUpdated 16 years ago
Descriptionplain2010-10-02 02:52:06
The compiled path for [dict append] and [dict lappend] appears to be broken in the HEAD.
1. $ tclsh8.6
2. % set d {a 1 b 2 c 3}
3. a 1 b 2 c 3
4. % dict append d b 22
5. a 1 b 222 c 3
6. % proc x {} { set d {a 1 b 2 c 3}; dict append d b 22 }
7. % x
8. a 1 b 2 c 3
9. % exit
10.
11. $ tclsh8.5
12. % set d {a 1 b 2 c 3}
13. a 1 b 2 c 3
14. % dict append d b 22
15. a 1 b 222 c 3
16. % proc x {} { set d {a 1 b 2 c 3}; dict append d b 22 }
17. % x
18. a 1 b 222 c 3
19. % exit
The problem appears to be in tclExecute.c, and not in the compilation proc (I first spotted it in attempting to run TAL code with a 'dictAppend' instruction.)
kennykbplain2010-10-02 09:54:18
It's somewhat alarming that there is no test case that detected this.
dkfplain2010-10-02 19:38:47
allow_comments - 1 The problem was that there was a failure to invalidate the dictionary's string representation in some cases. Tcl_DictObjPut does it, but wasn't always called by compiled [dict append]. [dict lappend] had the same problem.
Log in (anonymous is fine) to add a comment.