mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 17:10:47 +00:00
Don't use sys.stdout to find global handle
* Instead store sys._renderdoc_internal that won't be overwritten.
This commit is contained in:
@@ -333,6 +333,7 @@ void PythonContext::GlobalInit()
|
||||
|
||||
PyObject *redirector = PyObject_CallFunction((PyObject *)&OutputRedirectorType, noparams);
|
||||
PyObject_SetAttrString(sysobj, "stdout", redirector);
|
||||
PyObject_SetAttrString(sysobj, "_renderdoc_internal", redirector);
|
||||
|
||||
OutputRedirector *output = (OutputRedirector *)redirector;
|
||||
output->isStdError = 0;
|
||||
@@ -653,10 +654,10 @@ QString PythonContext::LoadExtension(ICaptureContext &ctx, const rdcstr &extensi
|
||||
|
||||
PyObject *ext = NULL;
|
||||
|
||||
current_global_handle = PyObject_SafeGetAttrString(sysobj, "stdout");
|
||||
current_global_handle = PyObject_SafeGetAttrString(main_dict, "_renderdoc_internal");
|
||||
|
||||
if(!syspath)
|
||||
qCritical() << "couldn't get sys.stdout";
|
||||
qCritical() << "couldn't get _renderdoc_internal";
|
||||
|
||||
QString typeStr;
|
||||
QString valueStr;
|
||||
@@ -1444,9 +1445,10 @@ extern "C" PyObject *GetCurrentGlobalHandle()
|
||||
PyObject *sys = PyImport_ImportModule("sys");
|
||||
if(sys)
|
||||
{
|
||||
PyObject *ret = PyObject_SafeGetAttrString(sys, "stdout");
|
||||
PyObject *ret = PyObject_SafeGetAttrString(sys, "_renderdoc_internal");
|
||||
|
||||
Py_XDECREF(sys);
|
||||
return ret;
|
||||
Py_XDECREF(ret);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user