static PyObject *methodwrapper_call(pyMethodWrapperObject *obj, PyObject *args, PyObject *kws) {
PyObject *methodwrapper_call(pyMethodWrapperObject *obj, PyObject *args, PyObject *kws) {
static PyObject *methodwrapper_call(pyMethodWrapperObject *obj, PyObject *args, PyObject *kws) {	QObject *wrapped = obj->wrapped;	// Error checking for deleted objects	if (!wrapped) {		PyErr_Format(PyExc_RuntimeError, "Unable to call methods on an object that has already been deleted.");		return 0;	}	// Iterate over the methods found in the wrapped object and find a suitable overload	const QMetaObject *meta = wrapped->metaObject();	// Save the number of passed arguments	uint passedArguments = PyTuple_Size(args);	// Limit the number of arguments for internal slots to 10.	// This makes several things a LOT easier.	if (passedArguments > 10) {		PyErr_Format(PyExc_RuntimeError, "The maximum number of 10 arguments for an internal slot has been exceeded.");		return 0;	}	// Iterate over the methods for this object	for (uint i = 0; i < obj->wrappedMethodsCount; ++i) {		QMetaMethod method = meta->method(obj->wrappedMethods[i]);		QList<QByteArray> parameters = method.parameterTypes();		// Skip this method if the number of arguments doesn't match		if (parameters.count() != passedArguments) {			continue;		}		// Check the argument types for compatibility		uint pi = 0;		bool compatible = true;		foreach (QByteArray parameterType, parameters) {			// Check if the input pyobject can be directly converted into the target type			if (!canConvert(PyTuple_GET_ITEM(args, pi++), parameterType)) {				compatible = false;				break;			}		}		if (!compatible) {			continue; // One of the types doesn't match		}		QString returnType = method.typeName();		if (returnType.startsWith("const ")) {			returnType = returnType.mid(6);		}		// Create a list of pointers for the arguments		void *paramList[11];		QMetaType::Type returnValueType = QMetaType::Void;		allocPythonToQt(paramList, 0, returnType, 0, &returnValueType); // Create return value		pi = 0;		foreach (QByteArray parameterType, parameters) {			allocPythonToQt(paramList, pi+1, parameterType, PyTuple_GET_ITEM(args, pi), 0);			++pi;		}		wrapped->qt_metacall(QMetaObject::InvokeMetaMethod, obj->wrappedMethods[i], paramList);		if (returnType == "PyObject*") {			return *(PyObject**)paramList[0];		} else {			return toPython(paramList[0], returnValueType);		}	}	PyErr_SetString(PyExc_RuntimeError, "Did not found a suitable overload for calling the method with the given arguments.");	return 0;}