|
2025-09-08
| ||
| 09:02 | Refactoring for [0439e1e1a3] check-in: 82960a9a6f user: jan.nijtmans tags: core-9-0-branch | |
|
2025-09-07
| ||
| 10:11 | More follow-up to [0439e1e1a3]: Slow detection of illegal expr argument, some refactoring check-in: eda10ad40c user: jan.nijtmans tags: bug-0439e1e1a3 | |
|
2025-09-06
| ||
| 10:35 | More follow-up to [0439e1e1a3]: Slow detection of illegal expr argument. More functions which can be... closed check-in: afd59a5bdf user: jan.nijtmans tags: mistake | |
| 10:32 | • Ticket [10545687da] Improve Tcl_GetNumberFromObj with abstract list interfaces</... artifact: e8df6e42fe user: jan.nijtmans | |
|
2024-10-16
| ||
| 14:14 | Merge [a618dcb27007fabd]: Follow-up for [0439e1e1a3]: Slow detection of illegal expr argument. Same ... check-in: e6bb32f3f4 user: pooryorick tags: unchained, INCOMPATIBLE_LICENSE | |
|
2024-10-08
| ||
| 22:40 | • Closed ticket [0439e1e1a3]: Slow detection of illegal expr argument plus 6 o... artifact: 2c2f7d6d47 user: jan.nijtmans | |
| 22:36 | Follow-up for [0439e1e1a3]: Slow detection of illegal expr argument. Same fix in more places. Only ... check-in: a618dcb270 user: jan.nijtmans tags: trunk, main | |
| 22:26 | Fix [0439e1e1a3]: Slow detection of illegal expr argument check-in: f10435bb91 user: jan.nijtmans tags: core-8-branch | |
|
2024-10-07
| ||
| 20:12 | Merge [53e5096b315bd094]: Modify fix for [0439e1e1a3], no conversion to list any more. Reported by A... check-in: 64845eec91 user: pooryorick tags: unchained, INCOMPATIBLE_LICENSE | |
|
2024-09-26
| ||
| 19:45 | • Ticket [0439e1e1a3] Slow detection of illegal expr argument status still Ope... artifact: 686b6fc13b user: jan.nijtmans | |
| 17:01 | • Ticket [0439e1e1a3]: 3 changes artifact: 9721cfc297 user: dgp | |
|
2024-09-25
| ||
| 07:38 | Modify fix for [0439e1e1a3], no conversion to list any more. Reported by AKU. check-in: 53e5096b31 user: jan.nijtmans tags: trunk, main | |
|
2024-08-30
| ||
| 16:10 | Merge [a197811f135d262b]: Fix [0439e1e1a3]: Slow detection of illegal expr argument. check-in: 244c834170 user: pooryorick tags: unchained, INCOMPATIBLE_LICENSE | |
|
2024-07-09
| ||
| 13:38 | • Ticket [0439e1e1a3] Slow detection of illegal expr argument status still Ope... artifact: 1ec8413c9b user: jan.nijtmans | |
| 13:37 | [0439e1e1a3]: Slow detection of illegal expr argument. Handle more of the same. check-in: 5d33330757 user: jan.nijtmans tags: bug-0439e1e1a3 | |
| 09:32 | • Ticket [0439e1e1a3] Slow detection of illegal expr argument status still Ope... artifact: cd5af38b9e user: jan.nijtmans | |
| 08:22 | Fix [0439e1e1a3]: Slow detection of illegal expr argument check-in: a197811f13 user: jan.nijtmans tags: trunk, main | |
|
2024-07-08
| ||
| 20:29 | • Ticket [0439e1e1a3] Slow detection of illegal expr argument status still Ope... artifact: bc83c84951 user: jan.nijtmans | |
| 20:27 | • Ticket [0439e1e1a3]: 3 changes artifact: 00d3f1202a user: jan.nijtmans | |
|
2024-07-07
| ||
| 14:10 | • Ticket [0439e1e1a3]: 3 changes artifact: 36ede3212e user: jan.nijtmans | |
| 14:10 | • Ticket [0439e1e1a3]: 3 changes artifact: 437fb36327 user: jan.nijtmans | |
|
2024-07-05
| ||
| 10:01 | • Ticket [0439e1e1a3]: 3 changes artifact: 3ca4d20084 user: jan.nijtmans | |
| 10:00 | Possible fix for [0439e1e1a3]: Slow detection of illegal expr argument check-in: 3dd367db1c user: jan.nijtmans tags: bug-0439e1e1a3 | |
| 09:03 | • New ticket [0439e1e1a3] Slow detection of illegal expr argument. artifact: 2fa5bded1e user: jan.nijtmans | |
Slow detection of illegal expr argument
$ tclsh9.0
% set x [lseq 1 11111111111111];set y 5
5
% expr {$x+$y}
Doing this hangs a long time, because a string representation is generated for the lseq. But we know already that an lseq with 0 or >1 entry can never be handled by '+'. Would be nice to detect that early, without taking that much time.
82960a9a6fRefactoring for [0439e1e1a3] check-in2025-09-08 09:02:46eda10ad40cMore follow-up to [0439e1e1a3]: Slow detection of illegal expr argument, some refactoring check-in2025-09-07 10:11:36afd59a5bdfMore follow-up to [0439e1e1a3]: Slow detection of illegal expr argument. More functions which can benefit from this check-in2025-09-06 10:35:11e8df6e42feTicket [10545687da] Improve Tcl_GetNumberFromObj with abstract list interfaces status still Open with 3 other changes ticket2025-09-06 10:32:24e6bb32f3f4Merge [a618dcb27007fabd]: Follow-up for [0439e1e1a3]: Slow detection of illegal expr argument. Same fix in more places. Only use "list" for real lists. check-in2024-10-16 14:14:13a618dcb270Follow-up for [0439e1e1a3]: Slow detection of illegal expr argument. Same fix in more places. Only use "list" for real lists check-in2024-10-08 22:36:25f10435bb91Fix [0439e1e1a3]: Slow detection of illegal expr argument check-in2024-10-08 22:26:2564845eec91Merge [53e5096b315bd094]: Modify fix for [0439e1e1a3], no conversion to list any more. Reported by AKU. check-in2024-10-07 20:12:0753e5096b31Modify fix for [0439e1e1a3], no conversion to list any more. Reported by AKU. check-in2024-09-25 07:38:41244c834170Merge [a197811f135d262b]: Fix [0439e1e1a3]: Slow detection of illegal expr argument. check-in2024-08-30 16:10:385d33330757[0439e1e1a3]: Slow detection of illegal expr argument. Handle more of the same. check-in2024-07-09 13:37:59a197811f13Fix [0439e1e1a3]: Slow detection of illegal expr argument check-in2024-07-09 08:22:433dd367db1cPossible fix for [0439e1e1a3]: Slow detection of illegal expr argument check-in2024-07-05 10:00:58
I think [2290847d23a494e4|this] is how it should be:
If the obj being handled by "expr" can be represented as a list and has more than 1 element (so a dict as well), it now gives a slightly different error-message:
<pre>
% set x [lseq 1 11111111111111];set y 5
5
% expr {$x+$y}
can't use a list as operand of "+"
</pre>
A side-effect of this is that Tcl_GetNumberFromObj() now tries to
convert the object to a list, if it isn't already one of the
other known types (like dict, lseq, or index). That's very useful in
further error-handling, since the typePtr or lengthProc then
can be inspected for this case without trying to do more parsing.
It might also be very useful for the implementation of a future
Tcl_GetValueFromObj() ....
I think [this] is how it should be:
If the obj being handled by "expr" can be represented as a list and has more than 1 element (so a dict as well), it now gives a slightly different error-message:
% set x [lseq 1 11111111111111];set y 5
5
% expr {$x+$y}
can't use a list as operand of "+"
A side-effect of this is that Tcl_GetNumberFromObj() now tries to convert the object to a list, if it isn't already one of the other known types (like dict, lseq, or index). That's very useful in further error-handling, since the typePtr or lengthProc then can be inspected for this case without trying to do more parsing.
It might also be very useful for the implementation of a future Tcl_GetValueFromObj() ....
Remark by Brian Griffin:
The only change I would recommend is to not use a contraction in the error message. In other words, use “cannot” instead of “can’t”. IMO, messages should be formal, not conversational.-Brian
Christian Werner wrote:
While I fully support elimination of single single quotes in error messages regardless of formalism or conversation I wonder how many omelettes we'll be able to make from the potentially many broken eggs. Alternatively, we could conserve these eggs for later.Best, Christian
While testing:
$ tclsh9.0
% set x [lseq 1 11111111111111];set y 5
5
% if {$x} {puts stdout abc}
This also hangs, and could be handled the same way.
More examples handled now (integers and doubles):
$ tclsh9.0 % set x [lseq 1 11111111111111] 5 % binary encode base64 -maxlen $x data expected integer but got a list % binary format d $x expected floating-point number but got a list
See: [5d333307578b6a00]
Beware that TclMaxListLength() is not written to be accurate. It is written to be reasonably quick, and to produce an over-estimate of how many elements the list might have -- if it is a list at all. Calling something "a list" because TMLL() returns a value bigger than 1 is not an accurate claim.
> Calling something "a list" because TMLL() returns a value bigger than 1 is not an accurate claim.
Indeed! There's still time until 9.0.1 to make it better. Current use was meant as a quick fix, in order to - at least - prevent conversion to a list.
Should be [better] now. Also (partly) backported to 8.7