[GRASS-dev] [GRASS GIS] #2581: Fix Python ctypes conversion for stat64 struct on GNU/Hurd

GRASS GIS trac at osgeo.org
Tue Feb 10 10:30:51 PST 2015


#2581: Fix Python ctypes conversion for stat64 struct on GNU/Hurd
---------------------------+------------------------------------------------
 Reporter:  sebastic       |       Owner:  grass-dev@…              
     Type:  defect         |      Status:  new                      
 Priority:  normal         |   Milestone:  7.0.0                    
Component:  Python ctypes  |     Version:  svn-releasebranch70      
 Keywords:                 |    Platform:  Other Unix               
      Cpu:  x86-32         |  
---------------------------+------------------------------------------------

Comment(by glynn):

 Replying to [ticket:2581 sebastic]:

 > The attached patch encloses the Python ternary expression in parenthesis
 to fix an issue with the C to Python conversion of the stat & stat64
 structs on GNU/Hurd.

 It would be better to use Python's own conditional-expression syntax (a if
 cond else b). The and-or hack produces the wrong answer if the if-true
 expression evaluates to false.

 Python's conditional-expression syntax probably didn't exist when
 ctypesgen was written (it was added in 2.5), but GRASS doesn't support any
 Python version old enough for that to matter (IIRC, we officially require
 at least 2.6, and having 2.7-isms slip into the code by accident hasn't
 been particularly uncommon).

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/2581#comment:2>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list