Tk Library Source Code

View Ticket
Login
Ticket UUID: 3396787
Title: strange if condition in json::write
Type: Bug Version: None
Submitter: uring Created on: 2011-08-23 09:17:27
Subsystem: json Assigned To: andreas_kupries
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2011-08-25 03:10:27
Resolution: Fixed Closed By: andreas_kupries
    Closed on: 2011-08-24 20:10:27
Description:
proc ::json::write::indented and proc ::json::write::aligned both start with the following test:

if {[llength [info level]] > 2} { 

this should never ever be true. possibly " ..[info level 0].." was meant, but if I try [::json::write::indented 1 1] for example,
the interpreter would interupt execution, throwing an error itself, doesn't it.
User Comments: andreas_kupries added on 2011-08-25 03:10:27:

allow_comments - 1

Yes, it should be [info level 0].
And yes, throwing an error for 
    ::json::write::indented 1 1
is the correct thing, because only a single argument is allowed.

Note that [info level 0] returns not just the arguments, but the command name itself as well.
Fixed in CVS head.
Bumped to version 1.0.1.