23 inline char *chr(
const char*
c){
return const_cast<char*
>(
c); }
30 ( PyObject*
self,
const char* method )
37 PyObject* r = PyObject_CallMethod(
self, chr(method), chr(
""));
39 if ( 0 == r ) { PyErr_Print() ;
return sc ; }
41 if ( PyInt_Check ( r ) )
42 { sc = PyInt_AS_LONG( r ) ; Py_DECREF( r ) ;
return sc ; }
46 PyObject*
c = PyObject_CallMethod(r, chr(
"getCode"), chr(
""));
48 if ( 0 == c ) { PyErr_Print() ; }
49 else if ( PyLong_Check( c )) { sc = PyLong_AsLong( c ); }
54 msg +=
"().getCode()' " ;
55 PyErr_SetString( PyExc_TypeError , msg.c_str() ) ;