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>2009-02-22 13:22:49 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-02-22 13:22:49 +0300
commit570b48aae6f074ed19a3fc58b8e2a34b38123a49 (patch)
treeed0b8b2b47a54cc5937334edb8acd0a26286596e /source/gameengine
parent9d5c2af1d1e11d40fec6c0da96cb37de1684f13c (diff)
BGE Py API
print filename:line with ShowDeprecationWarning(). Typo in scripttemplate_gamelogic.py removed 2 unneeded typedefs
Diffstat (limited to 'source/gameengine')
-rw-r--r--source/gameengine/Expressions/Value.cpp37
1 files changed, 36 insertions, 1 deletions
diff --git a/source/gameengine/Expressions/Value.cpp b/source/gameengine/Expressions/Value.cpp
index f30dd1a71ed..9b26cda01b3 100644
--- a/source/gameengine/Expressions/Value.cpp
+++ b/source/gameengine/Expressions/Value.cpp
@@ -859,7 +859,42 @@ void CValue::SetDeprecationWarnings(bool ignoreDeprecationWarnings)
void CValue::ShowDeprecationWarning(const char* old_way,const char* new_way)
{
- if (!m_ignore_deprecation_warnings)
+ if (!m_ignore_deprecation_warnings) {
printf("Method %s is deprecated, please use %s instead.\n", old_way, new_way);
+
+ // import sys; print '\t%s:%d' % (sys._getframe(0).f_code.co_filename, sys._getframe(0).f_lineno)
+
+ PyObject *getframe, *frame;
+ PyObject *f_lineno, *f_code, *co_filename;
+
+ getframe = PySys_GetObject("_getframe"); // borrowed
+ if (getframe) {
+ frame = PyObject_CallObject(getframe, NULL);
+ if (frame) {
+ 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");
+ if (co_filename) {
+
+ printf("\t%s:%d\n", PyString_AsString(co_filename), (int)PyInt_AsLong(f_lineno));
+
+ Py_DECREF(f_lineno);
+ Py_DECREF(f_code);
+ Py_DECREF(co_filename);
+ Py_DECREF(frame);
+ return;
+ }
+ }
+
+ Py_XDECREF(f_lineno);
+ Py_XDECREF(f_code);
+ Py_DECREF(frame);
+ }
+
+ }
+ PyErr_Clear();
+ printf("\tERROR - Could not access sys._getframe(0).f_lineno or sys._getframe().f_code.co_filename\n");
+ }
}