Overview
| Artifact ID: | a6e80750d888e2b2356894c4bd26ba3a26695bee92ef494c81dd7d5c55b85782 |
|---|---|
| Ticket: | a34733451b2cf189528061944466cf7ce7015008
Regression with TIP #636 in foreach |
| User & Date: | griffin on 2023-07-12 03:34:16 |
Changes
- icomment:
What happened? * Canvas widget defines an option table the includes the string "coords" * Testcase has: "foreach coord $pixelCoords {..." * Internal to the foreach command, a copy of the variable argument is made using TclDuplicatePureObj(). * The "coord" argument ends up as a shared Obj with a type of "index" ObjType. * (this is due to use of an abbreviated "coord" keyword to a canvas command somewhere in an earlier test. Probably hundreds of them.) * The internal rep matches the "coords" value in the canvas option table. * The Dup-Pure removes the string rep, leaving the "index" ObjType internal rep. * The var lookup code requests the string, which is generated from the option table, and returns "coords" * The lookup fails because the variable name is "coord". Take away: * I think TclDuplicatePureObj() is dangerous. Uses should be inspected carefully. * I think the option table implementation is violating consistency promise between internal rep and string rep. This issue has been fixed by replacing TclDuplicatePureObj with Tcl_DuplicateObj(). In this case, the values are var names. It's all about the string here. - login: "griffin"
- mimetype: "text/x-markdown"