|
2008-07-21
| ||
| 05:06 | • Closed ticket [2008248fff]: dict to list changes element representations plu... artifact: 62c240468f user: dkf | |
| 00:56 | • Ticket [2008248fff]: 4 changes artifact: 6f05baa9c3 user: dkf | |
|
2008-07-11
| ||
| 17:39 | • Ticket [2008248fff]: 6 changes artifact: 19682ba172 user: dkf | |
| 14:52 | • Ticket [2008248fff]: 1 change artifact: f36265b72f user: dkf | |
|
2008-07-02
| ||
| 23:07 | • Ticket [2008248fff]: 4 changes artifact: 06cd4da6da user: ajpasadyn | |
| 23:07 | • Add attachment tcllist.patch to ticket [2008248fff] artifact: 5107f39d33 user: ajpasadyn | |
| 23:02 | • Ticket [2008248fff] dict to list changes element representations status stil... artifact: 34d811c8f5 user: ajpasadyn | |
| 05:33 | • Ticket [2008248fff]: 4 changes artifact: f33d932967 user: ajpasadyn | |
| 03:54 | • Ticket [2008248fff]: 4 changes artifact: 3179ac9852 user: ajpasadyn | |
| 03:51 | • Add attachment jtest.tcl to ticket [2008248fff] artifact: 6238afd5cf user: ajpasadyn | |
| 03:51 | • Ticket [2008248fff] dict to list changes element representations status stil... artifact: 8cf179eaac user: ajpasadyn | |
|
2008-07-01
| ||
| 20:51 | • New ticket [2008248fff]. artifact: 1a890f96c5 user: ajpasadyn | |
dict to list changes element representations
Closed / Fixed2008248fffffffffffffffffffffffffffffffffCreated 18 years agoUpdated 18 years ago
Descriptionplain2008-07-01 20:51:39
I found an issue while using TclBlend in Tcl 8.5, and the attached script demonstrates it. Basically, the conversion of an internal representation from list to dict is special cased to keep the representations of the elements, while the conversion from dict to list passes through a string-only representation. This appears even in code that does not explicitly use dict because the array get and set have changed to use dict now. TclBlend uses a special internal representation to hold references to Java objects, and if the internal representation is lost then the underlying object might get freed. This violates the "everything is a string" but in the past it's been sufficient to just make sure that the Tcl script itself was careful with the references it obtained. If the Tcl core changes internal representations beyond what is needed then an extension like this really does not seem to have much of a chance of working.
ajpasadynplain2008-07-02 03:51:39
File Added - 283351: jtest.tcl
ajpasadynplain2008-07-02 03:54:39
File Added - 283352: tcllist.patch Logged In: YES user_id=1055638 Originator: YES The attached patch seems to work for me, but I'd appreciate it if someone more familiar with this code could check it out. File Added: tcllist.patch
ajpasadynplain2008-07-02 05:33:59
Logged In: YES user_id=1055638 Originator: YES OK there is definitely something wrong with that patch because I got a crash in clock format with it applied. I'll look at it some more, but hopefully it's more obvious to someone here.
ajpasadynplain2008-07-02 23:02:33
File Deleted - 283352:
ajpasadynplain2008-07-02 23:07:27
File Added - 283441: tcllist.patch Logged In: YES user_id=1055638 Originator: YES It appears my mistake was not always passing at least 1 to NewListIntRep. I've fixed that. The reason it crashed was that the core is calling SetListFromAny with a null interp from several places. I had copied the Tcl_SetObjResult call when NewListIntRep fails from the "from string rep" branch in the same routine, so it hadn't occurred to me it wasn't safe. File Added: tcllist.patch
dkf Ticket [2008248fff]: 1 change
[History diff]2008-07-11 14:52:01
dkfplain2008-07-11 17:39:45
Logged In: YES user_id=79902 Originator: NO While Tcl's never guaranteed anything about representations, it would be nice to not lose them.
dkfplain2008-07-21 00:56:14
Logged In: YES user_id=79902 Originator: NO Fixed on HEAD. Backport needed.
dkfplain2008-07-21 05:06:20
Logged In: YES user_id=79902 Originator: NO Backported to 8.5 branch. Patch actually used takes some shortcuts that your suggestion didn't (since I know what the pre- and post-conditions on the core dict API functions are) but is otherwise the same. Thanks.
Log in (anonymous is fine) to add a comment.
Attachments:
- tcllist.patch [download] added by ajpasadyn on 2008-07-02 23:07:27. [details]
- jtest.tcl [download] added by ajpasadyn on 2008-07-02 03:51:39. [details]