Overview
| Artifact ID: | 200c0195363382070b32093c427f3c62957282a787fc7b7890847dd08a7ccc96 |
|---|---|
| Ticket: | 580808121389182456a680e5323ea346ac30e567
"string length" converts bytearrays to strings when traced |
| User & Date: | dgp on 2017-11-30 16:14:02 |
Changes
- icomment:
The tracing forces generation of a string rep. After the string rep is generated, the bytearray is no longer "pure" so it becomes worthless (Insert Standard Rant here), and can no longer take optimized paths in Tcl_GetCharLength() to prevent the shimmer to "string" type. In this particular case, the string in question is the empty string. The misbehavior does not happen in Tcl 8.7 because an additional optimization for strings of less than 2 bytes has been added. I have no qualms about backporting that small, obviously correct bit of code. See dgp-properbytearry branch for work toward making ByteArrays not be broken as designed anymore, but that's a Tcl 9 fix. All that said, it's also possible that the defects of non-pure bytearray values don't actually get in the way of getting a correct value out of Tcl_GetCharLength().
- login: "dgp"
- mimetype: "text/plain"