if (!dispelCall->isValid()) { PyErr_Format(PyExc_RuntimeError, "The function callback you specified was invalid: %s.", func.latin1()); return 0; }
static PyObject* wpChar_addtimer( wpChar* self, PyObject* args ){	if ( !self->pChar || self->pChar->free )		Py_RETURN_FALSE;	Q_UINT32 expiretime;	PyObject* expireFunction = 0;	PyObject* arguments = 0;	uchar persistent = 0;	uchar dispelable = 0;	PyObject* dispelName = 0;	PyObject* dispelFunction = 0;	if ( !PyArg_ParseTuple( args, "iOO|BBOO:char.addtimer", &expiretime, &expireFunction, &arguments, &persistent, &dispelable, &dispelName, &dispelFunction ) )		return 0;	if ( !PyList_Check( arguments ) )		return 0;	PythonFunction* expireCall = 0;	if ( !PyCallable_Check( expireFunction ) )	{		QString func = Python2QString( expireFunction );		if ( func.isNull() )		{			PyErr_SetString( PyExc_TypeError, "Bad argument on char.addtimer callback type" );			return 0;		}		Console::instance()->log( LOG_WARNING, tr("Using deprecated string as callback identifier [%1]").arg(func) );		expireCall = new PythonFunction( func );	}	else		expireCall = new PythonFunction( expireFunction );	PythonFunction* dispelCall = 0;	if ( dispelFunction )	{		if ( !PyCallable_Check( dispelFunction ) )		{			QString func = Python2QString( dispelFunction );			if ( func.isNull() )			{				PyErr_SetString( PyExc_TypeError, "Bad argument on char.addtimer callback type" );				return 0;			}			Console::instance()->log( LOG_WARNING, tr("Using deprecated string as callback identifier [%1]").arg(func) );			dispelCall = new PythonFunction( func );		}		else			dispelCall = new PythonFunction( expireFunction );	}	PyObject* py_args = PyList_AsTuple( arguments );	cPythonEffect* effect = new cPythonEffect( expireCall, py_args );	// Should we save this effect?	effect->setSerializable( persistent != 0 );	effect->dispellable = dispelable != 0;	effect->setDispelId( Python2QString( dispelName ) );	effect->setDispelFunc( dispelCall );	effect->setDest( self->pChar->serial() );	effect->setExpiretime_ms( expiretime );	Timers::instance()->insert( effect );	Py_RETURN_NONE;}