build 181231. cab control tweaks, python interpreter stderr initialization fail fallback, enabled cab reflections, more parameters exposed to python scripts, minor ai logic enhancements, minor debug enhancements

This commit is contained in:
tmj-fstate
2018-12-31 22:00:58 +01:00
parent 44a104bbd6
commit bdbbaafc83
14 changed files with 140 additions and 62 deletions

View File

@@ -90,13 +90,11 @@ auto python_taskqueue::init() -> bool {
stringioclassname != nullptr ?
PyObject_CallObject( stringioclassname, nullptr ) :
nullptr ) };
m_error = { (
m_stderr = { (
stringioobject == nullptr ? nullptr :
PySys_SetObject( "stderr", stringioobject ) != 0 ? nullptr :
stringioobject ) };
if( m_error == nullptr ) { goto release_and_exit; }
if( false == run_file( "abstractscreenrenderer" ) ) { goto release_and_exit; }
// release the lock, save the state for future use
@@ -315,13 +313,13 @@ python_taskqueue::error() {
if( PyErr_Occurred() == nullptr ) { return; }
if( m_error != nullptr ) {
if( m_stderr != nullptr ) {
// std err pythona jest buforowane
PyErr_Print();
auto *errortext { PyObject_CallMethod( m_error, "getvalue", nullptr ) };
auto *errortext { PyObject_CallMethod( m_stderr, "getvalue", nullptr ) };
ErrorLog( PyString_AsString( errortext ) );
// czyscimy bufor na kolejne bledy
PyObject_CallMethod( m_error, "truncate", "i", 0 );
PyObject_CallMethod( m_stderr, "truncate", "i", 0 );
}
else {
// nie dziala buffor pythona
@@ -343,7 +341,7 @@ python_taskqueue::error() {
}
auto *tracebacktext { PyObject_Str( traceback ) };
if( tracebacktext != nullptr ) {
WriteLog( PyString_AsString( tracebacktext ) );
ErrorLog( PyString_AsString( tracebacktext ) );
}
else {
WriteLog( "Python Interpreter: failed to retrieve the stack traceback" );