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>2011-05-29 15:05:52 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-05-29 15:05:52 +0400
commit11014aa34b26337023f53e75ebdc3432e7e116c2 (patch)
tree27930178224a6e4f174a49796afac2ec28606dc2 /source/gameengine
parentebdca474b5fbbf5da23055e8cbaa1d2e491fb94d (diff)
access pythons code object directly rather than attribute access.
Diffstat (limited to 'source/gameengine')
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.cpp3
-rw-r--r--source/gameengine/GameLogic/SCA_PythonController.cpp9
2 files changed, 2 insertions, 10 deletions
diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp
index 65c20cad518..10906cdae02 100644
--- a/source/gameengine/Expressions/PyObjectPlus.cpp
+++ b/source/gameengine/Expressions/PyObjectPlus.cpp
@@ -1198,14 +1198,13 @@ void PyDebugLine()
f_lineno= PyObject_GetAttrString(frame, "f_lineno");
f_code= PyObject_GetAttrString(frame, "f_code");
if (f_lineno && f_code) {
- co_filename= PyObject_GetAttrString(f_code, "co_filename");
+ co_filename= ((PyCodeObject *)f_code)->co_filename; /* borrow */
if (co_filename) {
printf("\t%s:%d\n", _PyUnicode_AsString(co_filename), (int)PyLong_AsSsize_t(f_lineno));
Py_DECREF(f_lineno);
Py_DECREF(f_code);
- Py_DECREF(co_filename);
Py_DECREF(frame);
return;
}
diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp
index d0c1155de96..19ddce13757 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonController.cpp
@@ -357,14 +357,7 @@ bool SCA_PythonController::Import()
m_function_argc = 0; /* rare cases this could be a function that isnt defined in python, assume zero args */
if (PyFunction_Check(m_function)) {
- PyObject *py_arg_count = PyObject_GetAttrString(PyFunction_GET_CODE(m_function), "co_argcount");
- if(py_arg_count) {
- m_function_argc = PyLong_AsLong(py_arg_count);
- Py_DECREF(py_arg_count);
- }
- else {
- PyErr_Clear(); /* unlikely to fail but just incase */
- }
+ m_function_argc= ((PyCodeObject *)PyFunction_GET_CODE(m_function))->co_argcount;
}
if(m_function_argc > 1) {