logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

[psycopg] #48: infinity patches for 1.1.20 break with None values: msg#00123

Subject: [psycopg] #48: infinity patches for 1.1.20 break with None values
#48: infinity patches for 1.1.20 break with None values
----------------------+-----------------------------------------------------
       Id:  48        |      Status:  new                           
Component:  psycopg1  |    Modified:  Thu Sep 22 17:32:18 2005      
 Severity:  critical  |   Milestone:                                
 Priority:  normal    |     Version:  1.1.19                        
    Owner:  fog       |    Reporter:  kev+initrdtrac@xxxxxxxxxxxxxxx
----------------------+-----------------------------------------------------
 the changes to the cast_DateTime method for infinity values in 1.1.20
 cause it to break with a supplied value of None. This causes the following
 exception to be raised

 UnboundLocalError: local variable 's' referenced before assignment

 The issue is due to misindented code following the patch, where the tests
 for infinity should require str to be a valid string. The following patch
 resolves the issue (whitespace formatting may be a problem on this wiki)


 {{{
 --- ZPsycopgDA/DA.py.orig       2005-09-22 16:08:26.000000000 +0100
 +++ ZPsycopgDA/DA.py    2005-09-22 16:08:47.000000000 +0100
 @@ -135,12 +135,12 @@
          else:
              s = dt[0]

 -    if s =='infinity':
 -        return 'infinity'
 -    elif s == '-infinity':
 -        return '-infinity'
 -    else:
 -        return DateTime(s)
 +        if s =='infinity':
 +            return 'infinity'
 +        elif s == '-infinity':
 +            return '-infinity'
 +        else:
 +            return DateTime(s)

  # Convert an ISO date string from postgres to a DateTime(zope version)
  # object.
 }}}

-- 
Ticket URL: <http://initd.org/tracker/psycopg/ticket/48>
psycopg <http://initd.org/>
psycopg
_______________________________________________
Psycopg mailing list
Psycopg-IAPFreCvJWPBWskQ1e/+sw@xxxxxxxxxxxxxxxx
http://lists.initd.org/mailman/listinfo/psycopg
<Prev in Thread] Current Thread [Next in Thread>