[Bugs] #1553 UNSP: cjson parser too buggy for exchange formats (such as Journal Entry Bundles)

Sugar Labs Bugs bugtracker-noreply at sugarlabs.org
Thu Nov 19 11:00:23 EST 2009


#1553: cjson parser too buggy for exchange formats (such as Journal Entry Bundles)
------------------------------------------+---------------------------------
    Reporter:  martin.langhoff            |          Owner:  alsroot                    
        Type:  defect                     |         Status:  new                        
    Priority:  Unspecified by Maintainer  |      Milestone:  Unspecified by Release Team
   Component:  journal                    |        Version:  0.84.x                     
    Severity:  Unspecified                |       Keywords:  r+                         
Distribution:  OLPC                       |   Status_field:  Unconfirmed                
------------------------------------------+---------------------------------
Changes (by tomeu):

  * keywords:  r? => r+


Comment:

 {{{
 -        return cjson.decode(open(metadata_path, 'r').read())
 +        f = open(metadata_path, 'r')
 +        try:
 +            json_data = f.read()
 +        finally:
 +            f.close()
 +        return json.read(json_data)
 }}}

 AFAIK, the fd is closed when the file object is released, so json_data =
 open(metadata_path, 'r').read() should be enough.

 Otherwise, r+ for the patch, though before committing I think we should
 post a big notice to sugar-devel and wait 2 days for any comments.

-- 
Ticket URL: <http://bugs.sugarlabs.org/ticket/1553#comment:4>
Sugar Labs <http://sugarlabs.org/>
Sugar Labs bug tracking system


More information about the Bugs mailing list