Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2008-08-14 07:23:36 +0400
committerCampbell Barton <ideasman42@gmail.com>2008-08-14 07:23:36 +0400
commit3f2cb6e87855e4afc2e26d87f36817a92490429e (patch)
tree8c9af32f0aa1e42a08cc6d9d2aac3f1c6c052535 /source/gameengine/Expressions/PyObjectPlus.cpp
parentd2750f7bda1e5e4e43df330ab49e677105e00d4f (diff)
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
Diffstat (limited to 'source/gameengine/Expressions/PyObjectPlus.cpp')
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp
index aabcd6cb71d..8937f481922 100644
--- a/source/gameengine/Expressions/PyObjectPlus.cpp
+++ b/source/gameengine/Expressions/PyObjectPlus.cpp
@@ -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