[GRASS-dev] Re: [GRASS GIS] #1646: GRASS ctypes exception handling

GRASS GIS trac at osgeo.org
Sat Apr 28 18:48:34 EDT 2012


#1646: GRASS ctypes exception handling
-----------------------------------------------------+----------------------
 Reporter:  huhabla                                  |       Owner:  grass-dev@…              
     Type:  enhancement                              |      Status:  new                      
 Priority:  normal                                   |   Milestone:  7.0.0                    
Component:  Python ctypes                            |     Version:  svn-trunk                
 Keywords:  setjmp, longjmp, Exception, gently exit  |    Platform:  All                      
      Cpu:  All                                      |  
-----------------------------------------------------+----------------------

Comment(by glynn):

 Replying to [comment:3 huhabla]:

 > A simple example:
 {{{
 CLEANUP_HANDLER = CFUNCTYPE(c_void_p, c_void_p)(cleanup_handler)
 }}}

 I think that this should be

 {{{
 CLEANUP_HANDLER = CFUNCTYPE(None, c_void_p)(cleanup_handler)
 }}}

 The return type should be "void", not "void *".

 > Raising a !FatalErrorException is a bit pointless, but it works as
 expected. The main problem is that i have no clue how to cast the Python
 string from void pointer in the clean up handler, or how to cast any other
 Python object i need to clean up?

 I think that the handler should just call sys.exit(), so that any exit
 handlers registered with atexit.register() are called.

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/1646#comment:4>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list