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-11-03 18:09:18 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-11-03 18:09:18 +0400
commit665f602f152984f5a6f4ea05a2a90382acbf700a (patch)
treea7fa9484a60ac20878e2687995d2fd955958a7f6 /source/gameengine/GameLogic
parentd210703bcaf89014495f761797ae50f362394697 (diff)
python string conversion
- use _PyUnicode_AsStringAndSize where possible - use %R for PyErr_Format(...) rather then running repr on the object explicitly - use const char
Diffstat (limited to 'source/gameengine/GameLogic')
-rw-r--r--source/gameengine/GameLogic/SCA_PythonController.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp
index 303b3e9529e..d69358928e6 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonController.cpp
@@ -199,7 +199,7 @@ SCA_IActuator* SCA_PythonController::LinkedActuatorFromPy(PyObject *value)
if (PyUnicode_Check(value)) {
/* get the actuator from the name */
- char *name= _PyUnicode_AsString(value);
+ const char *name= _PyUnicode_AsString(value);
for(it = lacts.begin(); it!= lacts.end(); ++it) {
if( name == (*it)->GetName() ) {
return *it;
@@ -214,12 +214,11 @@ SCA_IActuator* SCA_PythonController::LinkedActuatorFromPy(PyObject *value)
}
}
}
-
+
/* set the exception */
- PyObject *value_str = PyObject_Repr(value); /* new ref */
- PyErr_Format(PyExc_ValueError, "'%s' not in this python controllers actuator list", _PyUnicode_AsString(value_str));
- Py_DECREF(value_str);
-
+ PyErr_Format(PyExc_ValueError,
+ "%R not in this python controllers actuator list", value);
+
return NULL;
}
@@ -500,7 +499,7 @@ int SCA_PythonController::pyattr_set_script(void *self_v, const KX_PYATTRIBUTE_D
{
SCA_PythonController* self= static_cast<SCA_PythonController*>(self_v);
- char *scriptArg = _PyUnicode_AsString(value);
+ const char *scriptArg = _PyUnicode_AsString(value);
if (scriptArg==NULL) {
PyErr_SetString(PyExc_TypeError, "controller.script = string: Python Controller, expected a string script text");