[ctypes-commit] ctypes/source cfield.c,1.39,1.40
                
                Brought to you by:
                
                    theller
                    
                
            
            
        
        
        
    | 
     
      
      
      From: Thomas H. <th...@us...> - 2004-08-20 14:52:01
      
     
   | 
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17708 Modified Files: cfield.c Log Message: We cannot construct a Python object from a NULL pointer. If the error flag is already set, we simply return. If the error flag is not set, we must set it. Index: cfield.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/cfield.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** cfield.c 20 Aug 2004 14:24:15 -0000 1.39 --- cfield.c 20 Aug 2004 14:51:50 -0000 1.40 *************** *** 372,376 **** O_get(void *ptr, unsigned size) { ! return *(PyObject **)ptr; } --- 372,384 ---- O_get(void *ptr, unsigned size) { ! PyObject *ob = *(PyObject **)ptr; ! if (ob == NULL) { ! if (!PyErr_Occurred()) ! /* Set an error if not yet set */ ! PyErr_SetString(PyExc_ValueError, ! "PyObject is NULL?"); ! return NULL; ! } ! return ob; }  |