diff --git a/deps/obs-scripting/obs-scripting-python.c b/deps/obs-scripting/obs-scripting-python.c index bfef52ae1..f8ef1fc09 100644 --- a/deps/obs-scripting/obs-scripting-python.c +++ b/deps/obs-scripting/obs-scripting-python.c @@ -1644,9 +1644,11 @@ bool obs_scripting_load_python(const char *python_path) dstr_free(&old_path); #endif +#if PY_VERSION_HEX < 0x03070000 PyEval_InitThreads(); if (!PyEval_ThreadsInitialized()) return false; +#endif /* ---------------------------------------------- */ /* Must set arguments for guis to work */ diff --git a/deps/obs-scripting/obspython/obspython.i b/deps/obs-scripting/obspython/obspython.i index a5822eef6..a55e5e9dd 100644 --- a/deps/obs-scripting/obspython/obspython.i +++ b/deps/obs-scripting/obspython/obspython.i @@ -30,6 +30,15 @@ #include "obs-frontend-api.h" #endif +/* Redefine SWIG_PYTHON_INITIALIZE_THREADS if: + * - Python version is 3.7 or later because PyEval_InitThreads() became deprecated and unnecessary + * - SWIG version is not 4.1 or later because SWIG_PYTHON_INITIALIZE_THREADS will be define correctly + * with Python 3.7 and later */ +#if PY_VERSION_HEX >= 0x03070000 && SWIGVERSION < 0x040100 +#undef SWIG_PYTHON_INITIALIZE_THREADS +#define SWIG_PYTHON_INITIALIZE_THREADS +#endif + %} #define DEPRECATED_START @@ -82,6 +91,17 @@ static inline void wrap_blog(int log_level, const char *message) %ignore obs_hotkey_pair_register_service; %ignore obs_hotkey_pair_register_source; +/* The function gs_debug_marker_begin_format has a va_args. + * By default, SWIG just drop it and replace it with a single NULL pointer. + * Source: http://swig.org/Doc4.0/Varargs.html#Varargs_nn4 + * + * But the generated wrapper will make the compiler emit a warning + * because varargs is an unused parameter. + * So in the check step, varargs will be treated like any unused parameter. */ +%typemap(check) (const float color[4], const char *format, ...) { + (void)varargs; +} + %include "graphics/graphics.h" %include "graphics/vec4.h" %include "graphics/vec3.h"