comparison python/pydc/pydcext.c @ 44:0f86a5ecfe61

- python: allow None to be passed for 'p'ointers, always passing NULL
author Tassilo Philipp
date Tue, 27 Oct 2020 18:44:18 +0100
parents 1086ca649715
children
comparison
equal deleted inserted replaced
43:1086ca649715 44:0f86a5ecfe61
357 else if ( PyInt_Check(po) ) 357 else if ( PyInt_Check(po) )
358 p = (DCpointer) PyInt_AS_LONG(po); 358 p = (DCpointer) PyInt_AS_LONG(po);
359 #endif 359 #endif
360 else if ( PyLong_Check(po) ) 360 else if ( PyLong_Check(po) )
361 p = (DCpointer) PyLong_AsVoidPtr(po); 361 p = (DCpointer) PyLong_AsVoidPtr(po);
362 else if ( po == Py_None )
363 p = NULL;
362 else 364 else
363 return PyErr_Format( PyExc_RuntimeError, "arg %d - expecting a promoting pointer-type (int, bytearray)", pos ); 365 return PyErr_Format( PyExc_RuntimeError, "arg %d - expecting a promoting pointer-type (int, bytearray)", pos );
364 dcArgPointer(gpCall, p); 366 dcArgPointer(gpCall, p);
365 } 367 }
366 break; 368 break;