mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 09:00:44 +00:00
Fix some deprecated and internal Python C API usages
This commit is contained in:
@@ -258,6 +258,13 @@ void PythonContext::GlobalInit()
|
||||
PyImport_AppendInittab("renderdoc", &PyInit_renderdoc);
|
||||
PyImport_AppendInittab("qrenderdoc", &PyInit_qrenderdoc);
|
||||
|
||||
#if PY_VERSION_HEX > 0x030B0000
|
||||
PyConfig config;
|
||||
PyConfig_InitPythonConfig(&config);
|
||||
config.configure_c_stdio = 0;
|
||||
config.parse_argv = 0;
|
||||
#endif
|
||||
|
||||
#if defined(STATIC_QRENDERDOC)
|
||||
// add the location where our libs will be for statically-linked python installs
|
||||
{
|
||||
@@ -267,17 +274,31 @@ void PythonContext::GlobalInit()
|
||||
|
||||
pylibs.toWCharArray(python_home);
|
||||
|
||||
#if PY_VERSION_HEX > 0x030B0000
|
||||
config.home = python_home;
|
||||
#else
|
||||
Py_SetPythonHome(python_home);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if PY_VERSION_HEX > 0x030B0000
|
||||
config.program_name = program_name;
|
||||
|
||||
config.use_environment = 0;
|
||||
|
||||
Py_InitializeFromConfig(&config);
|
||||
#else
|
||||
Py_SetProgramName(program_name);
|
||||
|
||||
Py_IgnoreEnvironmentFlag = 1;
|
||||
|
||||
Py_Initialize();
|
||||
#endif
|
||||
|
||||
#if PY_VERSION_HEX < 0x03090000
|
||||
PyEval_InitThreads();
|
||||
#endif
|
||||
|
||||
OutputRedirectorType.tp_name = "renderdoc_output_redirector";
|
||||
OutputRedirectorType.tp_basicsize = sizeof(OutputRedirector);
|
||||
|
||||
@@ -470,9 +470,9 @@ extern "C" PyObject *RENDERDOC_DumpObject(PyObject *obj)
|
||||
void *resptr = NULL;
|
||||
|
||||
// for basic types, return the repr directly
|
||||
if(obj == (PyObject *)&_Py_TrueStruct ||
|
||||
obj == (PyObject *)&_Py_FalseStruct ||
|
||||
PyObject_IsInstance(obj, (PyObject*)&_PyNone_Type) ||
|
||||
if(obj == Py_True ||
|
||||
obj == Py_False ||
|
||||
obj == Py_None ||
|
||||
PyObject_IsInstance(obj, (PyObject*)&PyFloat_Type) ||
|
||||
PyObject_IsInstance(obj, (PyObject*)&PyLong_Type) ||
|
||||
PyObject_IsInstance(obj, (PyObject*)&PyBytes_Type) ||
|
||||
|
||||
Reference in New Issue
Block a user