Blender V4.5
python_compat.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
12
13#pragma once
14
15#include <Python.h>
16
17/* Removes `intialized` member from Python 3.13+. */
18#if PY_VERSION_HEX >= 0x030d0000
19# define PY_ARG_PARSER_HEAD_COMPAT()
20#elif PY_VERSION_HEX >= 0x030c0000
21/* Add `intialized` member for Python 3.12+. */
22# define PY_ARG_PARSER_HEAD_COMPAT() 0,
23#else
24# define PY_ARG_PARSER_HEAD_COMPAT()
25#endif
26
27/* Python 3.13 made some changes, use the "new" names. */
28#if PY_VERSION_HEX < 0x030d0000
29# define PyObject_GetOptionalAttr _PyObject_LookupAttr
30
31# define Py_IsFinalizing _Py_IsFinalizing
32#endif
33
34/* Python 3.14 made some changes, use the "new" names. */
35#if PY_VERSION_HEX < 0x030e0000
36# define Py_HashPointer _Py_HashPointer
37# define PyThreadState_GetUnchecked _PyThreadState_UncheckedGet
38
39/* TODO: Support: `PyDict_Pop`, it has different arguments. */
40#endif