if ( !toCall || !toCall->isValid() )
if ( !func.isEmpty() && ( !toCall || !toCall->isValid() ) )
static PyObject* wpSocket_sendgump( wpSocket* self, PyObject* args ){	// Parameters:	// x, y, nomove, noclose, nodispose, serial, type, layout, text, callback, args	int x, y;	bool nomove, noclose, nodispose;	unsigned int serial, type;	PyObject* layout;	PyObject* texts;	PyObject* py_args;	PyObject* callback = 0;	if ( !PyArg_ParseTuple( args, "iiBBBIIO!O!OO!:socket.sendgump", &x, &y, &nomove, &noclose, &nodispose, &serial, &type, &PyList_Type, &layout, &PyList_Type, &texts, &callback, &PyList_Type, &py_args ) )	{		return 0;	}	PythonFunction* toCall = 0;	if ( callback )	{		if ( !PyCallable_Check( callback ) )		{			QString func = Python2QString( callback );			if ( func.isNull() )			{				PyErr_SetString( PyExc_TypeError, "Bad argument on socket.sendgump callback type" );				return 0;			}			Console::instance()->log( LOG_WARNING, tr("Using deprecated string as callback identifier [%1]").arg(func) );			toCall = new PythonFunction( func );			if ( !toCall || !toCall->isValid() ) 			{				PyErr_Format(PyExc_RuntimeError, "The function callback you specified was invalid: %s", func.latin1());				return 0;			}		}		else			toCall = new PythonFunction( callback );	}	// Convert py_args to a tuple	py_args = PyList_AsTuple( py_args );	cPythonGump* gump = new cPythonGump( toCall, py_args );	if ( serial )		gump->setSerial( serial );	if ( type )		gump->setType( type );	gump->setX( x );	gump->setY( y );	gump->setNoClose( noclose );	gump->setNoMove( nomove );	gump->setNoDispose( nodispose );	Q_INT32 i;	for ( i = 0; i < PyList_Size( layout ); ++i )	{		PyObject* item = PyList_GetItem( layout, i );		if ( PyString_Check( item ) )		{			gump->addRawLayout( PyString_AsString( item ) );		}		else if ( PyUnicode_Check( item ) )		{			gump->addRawLayout( Python2QString( item ) );		}		else		{			gump->addRawLayout( "" );		}	}	for ( i = 0; i < PyList_Size( texts ); ++i )	{		PyObject* item = PyList_GetItem( texts, i );		if ( PyString_Check( item ) )		{			gump->addRawText( PyString_AsString( item ) );		}		else if ( PyUnicode_Check( item ) )		{			gump->addRawText( Python2QString( item ) );		}		else		{			gump->addRawText( "" );		}	}	self->pSock->send( gump );	return PyInt_FromLong( gump->serial() );}