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:
authorBastien Montagne <montagne29@wanadoo.fr>2015-06-29 18:10:42 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-06-29 18:10:42 +0300
commit58d6cbba6da31db8dc8a2b42d528b9a353081904 (patch)
tree04b57a2f809c6f08d84a082edf061f3ece631860 /source/gameengine/Expressions/PyObjectPlus.cpp
parent94549adec4b6857fb6ec4cf77606da51ff7c26b7 (diff)
parent295d0c52a26730edc6d4ed1276e4051cce006be5 (diff)
Merge branch 'master' into temp-ghash-setopstemp-ghash-setops
Diffstat (limited to 'source/gameengine/Expressions/PyObjectPlus.cpp')
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp
index a65d61bc98b..31a17bd0cbf 100644
--- a/source/gameengine/Expressions/PyObjectPlus.cpp
+++ b/source/gameengine/Expressions/PyObjectPlus.cpp
@@ -148,12 +148,18 @@ PyObject *PyObjectPlus::py_base_repr(PyObject *self) // This should be the ent
PyObject *PyObjectPlus::py_base_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyTypeObject *base_type;
- PyObjectPlus_Proxy *base = NULL;
- if (!PyArg_ParseTuple(args, "O:Base PyObjectPlus", &base))
+ /* one or more args is needed */
+ if (!PyTuple_GET_SIZE(args)) {
+ PyErr_SetString(PyExc_TypeError,
+ "Expected at least one argument");
return NULL;
+ }
+
+ PyObjectPlus_Proxy *base = (PyObjectPlus_Proxy *)PyTuple_GET_ITEM(args, 0);
- /* the 'base' PyObject may be subclassed (multiple times even)
+ /**
+ * the 'base' PyObject may be subclassed (multiple times even)
* we need to find the first C++ defined class to check 'type'
* is a subclass of the base arguments type.
*
@@ -162,12 +168,13 @@ PyObject *PyObjectPlus::py_base_new(PyTypeObject *type, PyObject *args, PyObject
* eg.
*
* # CustomOb is called 'type' in this C code
+ * \code{.py}
* class CustomOb(GameTypes.KX_GameObject):
* pass
*
* # this calls py_base_new(...), the type of 'CustomOb' is checked to be a subclass of the 'cont.owner' type
* ob = CustomOb(cont.owner)
- *
+ * \endcode
* */
base_type= Py_TYPE(base);
while (base_type && !BGE_PROXY_CHECK_TYPE(base_type))