| Ticket UUID: | 9eac2d8a8d6da83d4554afd55865a54691c4c58d | ||
| Title: | uplevel: level sniffing for single arg, default-level case (absolute level specifier only) | ||
| Type: | Bug | Created on: | 2019-05-07 22:07:05 |
| Submitter: | anonymous | Assigned to: | nobody |
| Subsystem: | 22. [proc] and [uplevel] | Severity: | Severe |
| Priority: | 5 Medium | Last modified: | 2020-09-19 17:28:27 |
| Status: | Open | Closed by: | nobody |
| Resolution: | None | Closed on: | |
| Version: | core-8-branch | ||
| Description: | ||||
Following up on the conversation at IRC:
«dkf» We used to do a nonsense parse where if the first argument started with a digit (IIRC), Tcl would assume that it was a level _even if that meant there were no other arguments_ (which was an error case)
«dkf» it shouldn’t ever consider an argument to be a level if there’s only one argument
In current 8.7, this holds but not for a single arg starting with a hash:
% namespace eval ::ns1 { uplevel {#0 b}}}
bad level "#0 b"
should read: invalid command "#0"
«dkf» ’tis a bug
«dkf» in 8.7
| ||||
| User Comments: | ||||
dgp added on 2019-05-08 18:00:00:
For some history, see https://core.tcl-lang.org/tcl/tktview/2673163 https://core.tcl-lang.org/tcl/info/1c6d19544d18c36a dgp added on 2019-05-08 18:50:07:
The documentation for [uplevel]:
https://www.tcl-lang.org/man/tcl8.7/TclCmd/uplevel.htm
clearly states " Level cannot be defaulted if the first command argument starts with a digit or #. "
So this is not a bug, but it is a report of absolutely boneheaded behavior.
We should TIP the fix, using the fact that we already did this for
[upvar] as justification.
pooryorick added on 2020-09-19 17:28:27:
See ticket [b9ecf3ce98] for a backwards-compatible solution that addresses most practical concerns by interpreting the first argument as a script if it is the only argument and is a list containing more than one item. | ||||
