game engine python api
* removed macros that were not used much, some misleading. * removed error string setting calls that overwrote the error set by PyArg_ParseTuple with a less useful one. * use python macros Py_RETURN_NONE, Py_RETURN_TRUE, Py_RETURN_FALSE
This commit is contained in:
@@ -94,7 +94,7 @@ PyObjectPlus::PyObjectPlus(PyTypeObject *T) // constructor
|
||||
* PyObjectPlus Methods -- Every class, even the abstract one should have a Methods
|
||||
------------------------------*/
|
||||
PyMethodDef PyObjectPlus::Methods[] = {
|
||||
{"isA", (PyCFunction) sPy_isA, Py_NEWARGS},
|
||||
{"isA", (PyCFunction) sPy_isA, METH_VARARGS},
|
||||
{NULL, NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
@@ -134,7 +134,8 @@ int PyObjectPlus::_setattr(const STR_String& attr, PyObject *value)
|
||||
------------------------------*/
|
||||
PyObject *PyObjectPlus::_repr(void)
|
||||
{
|
||||
Py_Error(PyExc_SystemError, "Representation not overridden by object.");
|
||||
PyErr_SetString(PyExc_SystemError, "Representation not overridden by object.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*------------------------------
|
||||
@@ -164,11 +165,12 @@ bool PyObjectPlus::isA(const char *mytypename) // check typename of each parent
|
||||
PyObject *PyObjectPlus::Py_isA(PyObject *args) // Python wrapper for isA
|
||||
{
|
||||
char *mytypename;
|
||||
Py_Try(PyArg_ParseTuple(args, "s", &mytypename));
|
||||
if (!PyArg_ParseTuple(args, "s", &mytypename))
|
||||
return NULL;
|
||||
if(isA(mytypename))
|
||||
{Py_INCREF(Py_True); return Py_True;}
|
||||
Py_RETURN_TRUE;
|
||||
else
|
||||
{Py_INCREF(Py_False); return Py_False;};
|
||||
Py_RETURN_FALSE;
|
||||
}
|
||||
|
||||
#endif //NO_EXP_PYTHON_EMBEDDING
|
||||
|
||||
Reference in New Issue
Block a user