obs-scripting: Fix macro redefinition warning

In Python 3.9+, `PyCFunction_New` and `PyCFunction_NewEx` are themselves
macros around `PyMethod_New`. To fix the warning, both macros need to
be untouched for those Python versions, instead the actual function
`PyMethod_New` needs to be imported and aliased.

This commit:

- Adds the import of the `PyCMethod_New` symbol
- Adds the function definition for `Import_PyCMethod_New`
- Adds the `PyCMethod_New` function alias
This commit is contained in:
PatTheMav 2022-05-09 11:57:19 +02:00 • committed by Jim
commit 8d0131c519
2 changed files with 11 additions and 0 deletions

View file

@ -113,6 +113,9 @@ bool import_python(const char *python_path)
IMPORT_FUNC(PyDict_GetItemString);
IMPORT_FUNC(PyDict_SetItemString);
IMPORT_FUNC(PyCFunction_NewEx);
#if PY_VERSION_HEX > 0x030900b0
IMPORT_FUNC(PyCMethod_New);
#endif
IMPORT_FUNC(PyModule_GetDict);
IMPORT_FUNC(PyModule_GetNameObject);
IMPORT_FUNC(PyModule_AddObject);