obs-scripting: Fix compiler warnings
* obs-scripting: Fix unused 'varargs' warning * obs-scripting: Fix PyEval deprecation warnings Remove PyEval_InitThreads() and PyEval_ThreadsInitialized() call for Python 3.7 and later as Python calls it automatically now. This removes deprecation warnings when using Python 3.9 or later. https://docs.python.org/3/c-api/init.html#c.PyEval_InitThreads
This commit is contained in:
parent
f4809b614e
commit
c98617849a
2
deps/obs-scripting/obs-scripting-python.c
vendored
2
deps/obs-scripting/obs-scripting-python.c
vendored
@ -1644,9 +1644,11 @@ bool obs_scripting_load_python(const char *python_path)
|
|||||||
dstr_free(&old_path);
|
dstr_free(&old_path);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if PY_VERSION_HEX < 0x03070000
|
||||||
PyEval_InitThreads();
|
PyEval_InitThreads();
|
||||||
if (!PyEval_ThreadsInitialized())
|
if (!PyEval_ThreadsInitialized())
|
||||||
return false;
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ---------------------------------------------- */
|
/* ---------------------------------------------- */
|
||||||
/* Must set arguments for guis to work */
|
/* Must set arguments for guis to work */
|
||||||
|
20
deps/obs-scripting/obspython/obspython.i
vendored
20
deps/obs-scripting/obspython/obspython.i
vendored
@ -30,6 +30,15 @@
|
|||||||
#include "obs-frontend-api.h"
|
#include "obs-frontend-api.h"
|
||||||
#endif
|
#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
|
#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_service;
|
||||||
%ignore obs_hotkey_pair_register_source;
|
%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/graphics.h"
|
||||||
%include "graphics/vec4.h"
|
%include "graphics/vec4.h"
|
||||||
%include "graphics/vec3.h"
|
%include "graphics/vec3.h"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user