diff --git a/scripts/startup/bl_operators/image_as_planes.py b/scripts/startup/bl_operators/image_as_planes.py index 2277d887676..7d83b245aec 100644 --- a/scripts/startup/bl_operators/image_as_planes.py +++ b/scripts/startup/bl_operators/image_as_planes.py @@ -367,19 +367,19 @@ class TextureProperties_MixIn: description="How the image is extrapolated past its original bounds", ) - t = bpy.types.Image.bl_rna.properties["alpha_mode"] + _Image_alpha_mode = bpy.types.Image.bl_rna.properties["alpha_mode"] alpha_mode: EnumProperty( - name=t.name, - items=tuple((e.identifier, e.name, e.description) for e in t.enum_items), - default=t.default, - description=t.description, + name=_Image_alpha_mode.name, + items=tuple((e.identifier, e.name, e.description) for e in _Image_alpha_mode.enum_items), + default=_Image_alpha_mode.default, + description=_Image_alpha_mode.description, ) - t = bpy.types.ImageUser.bl_rna.properties["use_auto_refresh"] + _ImageUser_use_auto_refresh = bpy.types.ImageUser.bl_rna.properties["use_auto_refresh"] use_auto_refresh: BoolProperty( - name=t.name, + name=_ImageUser_use_auto_refresh.name, default=True, - description=t.description, + description=_ImageUser_use_auto_refresh.description, ) relative: BoolProperty( diff --git a/source/blender/python/bmesh/bmesh_py_types.cc b/source/blender/python/bmesh/bmesh_py_types.cc index b2cc9335d07..7de30705028 100644 --- a/source/blender/python/bmesh/bmesh_py_types.cc +++ b/source/blender/python/bmesh/bmesh_py_types.cc @@ -31,6 +31,8 @@ #include +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ + #include "../mathutils/mathutils.hh" #include "../generic/py_capi_utils.hh" @@ -3819,12 +3821,12 @@ static void bpy_bmelemseq_dealloc(BPy_BMElemSeq *self) /* not sure where this should go */ static Py_hash_t bpy_bm_elem_hash(PyObject *self) { - return _Py_HashPointer(((BPy_BMElem *)self)->ele); + return Py_HashPointer(((BPy_BMElem *)self)->ele); } static Py_hash_t bpy_bm_hash(PyObject *self) { - return _Py_HashPointer(((BPy_BMesh *)self)->bm); + return Py_HashPointer(((BPy_BMesh *)self)->bm); } /* Type Doc-strings diff --git a/source/blender/python/generic/blf_py_api.cc b/source/blender/python/generic/blf_py_api.cc index 9088aeb6fc7..c08379ac6c7 100644 --- a/source/blender/python/generic/blf_py_api.cc +++ b/source/blender/python/generic/blf_py_api.cc @@ -13,7 +13,7 @@ #include "blf_py_api.hh" -#include "../generic/py_capi_utils.hh" +#include "py_capi_utils.hh" #include @@ -25,7 +25,8 @@ #include "../../imbuf/IMB_imbuf.hh" #include "../../imbuf/IMB_imbuf_types.hh" -#include "python_compat.hh" +#include "python_compat.hh" /* IWYU pragma: keep. */ + #include "python_utildefines.hh" #include "imbuf_py_api.hh" diff --git a/source/blender/python/generic/bpy_threads.cc b/source/blender/python/generic/bpy_threads.cc index 6a932c3397a..666fc9d346a 100644 --- a/source/blender/python/generic/bpy_threads.cc +++ b/source/blender/python/generic/bpy_threads.cc @@ -11,6 +11,8 @@ #include +#include "python_compat.hh" /* IWYU pragma: keep. */ + #include "../BPY_extern.hh" BPy_ThreadStatePtr BPY_thread_save() @@ -20,7 +22,7 @@ BPy_ThreadStatePtr BPY_thread_save() * * `PyEval_SaveThread()` will release the GIL, so this thread has to have the GIL to begin with * or badness will ensue. */ - if (_PyThreadState_UncheckedGet() && PyGILState_Check()) { + if (PyThreadState_GetUnchecked() && PyGILState_Check()) { return (BPy_ThreadStatePtr)PyEval_SaveThread(); } return nullptr; diff --git a/source/blender/python/generic/idprop_py_api.cc b/source/blender/python/generic/idprop_py_api.cc index 55693cb0077..db266b47113 100644 --- a/source/blender/python/generic/idprop_py_api.cc +++ b/source/blender/python/generic/idprop_py_api.cc @@ -10,6 +10,8 @@ #include +#include "python_compat.hh" /* IWYU pragma: keep. */ + #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" @@ -142,7 +144,7 @@ static PyObject *idprop_py_from_idp_idparray(ID *id, IDProperty *prop) /* use for both array and group */ static Py_hash_t BPy_IDGroup_hash(BPy_IDProperty *self) { - return _Py_HashPointer(self->prop); + return Py_HashPointer(self->prop); } static PyObject *BPy_IDGroup_repr(BPy_IDProperty *self) diff --git a/source/blender/python/generic/idprop_py_ui_api.cc b/source/blender/python/generic/idprop_py_ui_api.cc index 7c78e4ac22f..dc80c9c79ee 100644 --- a/source/blender/python/generic/idprop_py_ui_api.cc +++ b/source/blender/python/generic/idprop_py_ui_api.cc @@ -8,6 +8,8 @@ #include +#include "python_compat.hh" /* IWYU pragma: keep. */ + #include "MEM_guardedalloc.h" #include "BLI_string.h" @@ -1009,7 +1011,7 @@ static PyObject *BPy_IDPropertyUIManager_repr(BPy_IDPropertyUIManager *self) static Py_hash_t BPy_IDPropertyUIManager_hash(BPy_IDPropertyUIManager *self) { - return _Py_HashPointer(self->property); + return Py_HashPointer(self->property); } PyTypeObject BPy_IDPropertyUIManager_Type = { diff --git a/source/blender/python/generic/imbuf_py_api.cc b/source/blender/python/generic/imbuf_py_api.cc index aa4f986de47..2422021d5b2 100644 --- a/source/blender/python/generic/imbuf_py_api.cc +++ b/source/blender/python/generic/imbuf_py_api.cc @@ -15,7 +15,7 @@ #include "py_capi_utils.hh" -#include "python_compat.hh" +#include "python_compat.hh" /* IWYU pragma: keep. */ #include "imbuf_py_api.hh" /* own include */ @@ -403,7 +403,7 @@ static PyObject *py_imbuf_repr(Py_ImBuf *self) static Py_hash_t py_imbuf_hash(Py_ImBuf *self) { - return _Py_HashPointer(self->ibuf); + return Py_HashPointer(self->ibuf); } PyTypeObject Py_ImBuf_Type = { diff --git a/source/blender/python/generic/python_compat.hh b/source/blender/python/generic/python_compat.hh index b8aa6d80e87..1c3a346cb9c 100644 --- a/source/blender/python/generic/python_compat.hh +++ b/source/blender/python/generic/python_compat.hh @@ -5,6 +5,9 @@ /** \file * \ingroup pygen * \brief header-only compatibility defines. + * + * \note this header should not be removed/cleaned where Python is used. + * Because its required for Blender to build against different versions of Python. */ #pragma once @@ -27,3 +30,11 @@ # define Py_IsFinalizing _Py_IsFinalizing #endif + +/* Python 3.14 made some changes, use the "new" names. */ +#if PY_VERSION_HEX < 0x030e0000 +# define Py_HashPointer _Py_HashPointer +# define PyThreadState_GetUnchecked _PyThreadState_UncheckedGet + +/* TODO: Support: `PyDict_Pop`, it has different arguments. */ +#endif diff --git a/source/blender/python/gpu/gpu_py_batch.cc b/source/blender/python/gpu/gpu_py_batch.cc index 3a89ebc479e..d291c800f40 100644 --- a/source/blender/python/gpu/gpu_py_batch.cc +++ b/source/blender/python/gpu/gpu_py_batch.cc @@ -20,7 +20,7 @@ #include "GPU_state.hh" #include "../generic/py_capi_utils.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ #include "gpu_py.hh" #include "gpu_py_element.hh" diff --git a/source/blender/python/gpu/gpu_py_compute.cc b/source/blender/python/gpu/gpu_py_compute.cc index bec33eed96e..d5b23d13c05 100644 --- a/source/blender/python/gpu/gpu_py_compute.cc +++ b/source/blender/python/gpu/gpu_py_compute.cc @@ -15,7 +15,7 @@ #include "GPU_compute.hh" #include "GPU_state.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ #include "gpu_py.hh" #include "gpu_py_compute.hh" /* own include */ diff --git a/source/blender/python/gpu/gpu_py_element.cc b/source/blender/python/gpu/gpu_py_element.cc index ddb747de53b..9ec50d9e46e 100644 --- a/source/blender/python/gpu/gpu_py_element.cc +++ b/source/blender/python/gpu/gpu_py_element.cc @@ -16,7 +16,7 @@ #include "MEM_guardedalloc.h" #include "../generic/py_capi_utils.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ #include "gpu_py.hh" #include "gpu_py_element.hh" /* own include */ diff --git a/source/blender/python/gpu/gpu_py_framebuffer.cc b/source/blender/python/gpu/gpu_py_framebuffer.cc index d859f07ebc2..e4cfef6641e 100644 --- a/source/blender/python/gpu/gpu_py_framebuffer.cc +++ b/source/blender/python/gpu/gpu_py_framebuffer.cc @@ -19,7 +19,7 @@ #include "GPU_init_exit.hh" #include "../generic/py_capi_utils.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ #include "../generic/python_utildefines.hh" #include "../mathutils/mathutils.hh" diff --git a/source/blender/python/gpu/gpu_py_offscreen.cc b/source/blender/python/gpu/gpu_py_offscreen.cc index 4639c21029e..a82d2a0c8ed 100644 --- a/source/blender/python/gpu/gpu_py_offscreen.cc +++ b/source/blender/python/gpu/gpu_py_offscreen.cc @@ -33,7 +33,7 @@ #include "../mathutils/mathutils.hh" #include "../generic/py_capi_utils.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ #include "gpu_py.hh" #include "gpu_py_texture.hh" diff --git a/source/blender/python/gpu/gpu_py_shader.cc b/source/blender/python/gpu/gpu_py_shader.cc index b672dd23bec..12977491d43 100644 --- a/source/blender/python/gpu/gpu_py_shader.cc +++ b/source/blender/python/gpu/gpu_py_shader.cc @@ -19,7 +19,7 @@ #include "GPU_uniform_buffer.hh" #include "../generic/py_capi_utils.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ #include "../generic/python_utildefines.hh" #include "../mathutils/mathutils.hh" diff --git a/source/blender/python/gpu/gpu_py_shader_create_info.cc b/source/blender/python/gpu/gpu_py_shader_create_info.cc index 9afd289a2ca..4b8a0eccf34 100644 --- a/source/blender/python/gpu/gpu_py_shader_create_info.cc +++ b/source/blender/python/gpu/gpu_py_shader_create_info.cc @@ -17,7 +17,7 @@ #include "intern/gpu_shader_create_info.hh" #include "../generic/py_capi_utils.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ #include "gpu_py_shader.hh" /* own include */ #include "gpu_py_texture.hh" diff --git a/source/blender/python/gpu/gpu_py_texture.cc b/source/blender/python/gpu/gpu_py_texture.cc index 353ee85b7eb..7a36457a939 100644 --- a/source/blender/python/gpu/gpu_py_texture.cc +++ b/source/blender/python/gpu/gpu_py_texture.cc @@ -24,7 +24,7 @@ #include "BKE_image.hh" #include "../generic/py_capi_utils.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ #include "gpu_py.hh" #include "gpu_py_buffer.hh" diff --git a/source/blender/python/gpu/gpu_py_uniformbuffer.cc b/source/blender/python/gpu/gpu_py_uniformbuffer.cc index 6fb756f9ee6..6589a7ec241 100644 --- a/source/blender/python/gpu/gpu_py_uniformbuffer.cc +++ b/source/blender/python/gpu/gpu_py_uniformbuffer.cc @@ -18,7 +18,7 @@ #include "GPU_context.hh" #include "GPU_uniform_buffer.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ #include "gpu_py.hh" #include "gpu_py_uniformbuffer.hh" /* own include */ diff --git a/source/blender/python/gpu/gpu_py_vertex_buffer.cc b/source/blender/python/gpu/gpu_py_vertex_buffer.cc index 58b555d144b..1d0b5c95e4b 100644 --- a/source/blender/python/gpu/gpu_py_vertex_buffer.cc +++ b/source/blender/python/gpu/gpu_py_vertex_buffer.cc @@ -14,7 +14,7 @@ #include "GPU_vertex_buffer.hh" #include "../generic/py_capi_utils.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ #include "gpu_py.hh" #include "gpu_py_vertex_buffer.hh" /* own include */ diff --git a/source/blender/python/gpu/gpu_py_vertex_format.cc b/source/blender/python/gpu/gpu_py_vertex_format.cc index 20d840432bc..a69dd31fb09 100644 --- a/source/blender/python/gpu/gpu_py_vertex_format.cc +++ b/source/blender/python/gpu/gpu_py_vertex_format.cc @@ -12,7 +12,7 @@ #include #include "../generic/py_capi_utils.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ #include "gpu_py.hh" #include "gpu_py_vertex_format.hh" /* own include */ diff --git a/source/blender/python/intern/bpy.cc b/source/blender/python/intern/bpy.cc index 8eabadfdc1c..4bf0fc14413 100644 --- a/source/blender/python/intern/bpy.cc +++ b/source/blender/python/intern/bpy.cc @@ -48,7 +48,7 @@ #include "bpy_utils_units.hh" #include "../generic/py_capi_utils.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ #include "../generic/python_utildefines.hh" /* external util modules */ diff --git a/source/blender/python/intern/bpy_app.cc b/source/blender/python/intern/bpy_app.cc index 5222018e5c1..2f1eb426ab4 100644 --- a/source/blender/python/intern/bpy_app.cc +++ b/source/blender/python/intern/bpy_app.cc @@ -54,7 +54,7 @@ #include "../generic/py_capi_rna.hh" #include "../generic/py_capi_utils.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ #ifdef BUILD_DATE extern "C" char build_date[]; @@ -696,7 +696,7 @@ PyObject *BPY_app_struct() BlenderAppType.tp_init = nullptr; BlenderAppType.tp_new = nullptr; /* Without this we can't do `set(sys.modules)` #29635. */ - BlenderAppType.tp_hash = (hashfunc)_Py_HashPointer; + BlenderAppType.tp_hash = (hashfunc)Py_HashPointer; /* Kind of a hack on top of #PyStructSequence. */ py_struct_seq_getset_init(); diff --git a/source/blender/python/intern/bpy_app_alembic.cc b/source/blender/python/intern/bpy_app_alembic.cc index a603ba17ab8..39a6c43fbe4 100644 --- a/source/blender/python/intern/bpy_app_alembic.cc +++ b/source/blender/python/intern/bpy_app_alembic.cc @@ -9,6 +9,8 @@ #include "BLI_utildefines.h" #include +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ + #include "bpy_app_alembic.hh" #include "../generic/py_capi_utils.hh" @@ -85,7 +87,7 @@ PyObject *BPY_app_alembic_struct() BlenderAppABCType.tp_init = nullptr; BlenderAppABCType.tp_new = nullptr; /* Without this we can't do `set(sys.modules)` #29635. */ - BlenderAppABCType.tp_hash = (hashfunc)_Py_HashPointer; + BlenderAppABCType.tp_hash = (hashfunc)Py_HashPointer; return ret; } diff --git a/source/blender/python/intern/bpy_app_build_options.cc b/source/blender/python/intern/bpy_app_build_options.cc index ccd5881f4e6..48ea8f8894e 100644 --- a/source/blender/python/intern/bpy_app_build_options.cc +++ b/source/blender/python/intern/bpy_app_build_options.cc @@ -8,6 +8,8 @@ #include +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ + #include "BLI_utildefines.h" #include "bpy_app_build_options.hh" @@ -350,7 +352,7 @@ PyObject *BPY_app_build_options_struct() BlenderAppBuildOptionsType.tp_init = nullptr; BlenderAppBuildOptionsType.tp_new = nullptr; /* Without this we can't do `set(sys.modules)` #29635. */ - BlenderAppBuildOptionsType.tp_hash = (hashfunc)_Py_HashPointer; + BlenderAppBuildOptionsType.tp_hash = (hashfunc)Py_HashPointer; return ret; } diff --git a/source/blender/python/intern/bpy_app_ffmpeg.cc b/source/blender/python/intern/bpy_app_ffmpeg.cc index 70f95360054..9aad512d60b 100644 --- a/source/blender/python/intern/bpy_app_ffmpeg.cc +++ b/source/blender/python/intern/bpy_app_ffmpeg.cc @@ -9,6 +9,8 @@ #include "BLI_utildefines.h" #include +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ + #include "bpy_app_ffmpeg.hh" #include "../generic/py_capi_utils.hh" @@ -130,7 +132,7 @@ PyObject *BPY_app_ffmpeg_struct() BlenderAppFFmpegType.tp_init = nullptr; BlenderAppFFmpegType.tp_new = nullptr; /* Without this we can't do `set(sys.modules)` #29635. */ - BlenderAppFFmpegType.tp_hash = (hashfunc)_Py_HashPointer; + BlenderAppFFmpegType.tp_hash = (hashfunc)Py_HashPointer; return ret; } diff --git a/source/blender/python/intern/bpy_app_handlers.cc b/source/blender/python/intern/bpy_app_handlers.cc index 275b790dd95..b75f6896840 100644 --- a/source/blender/python/intern/bpy_app_handlers.cc +++ b/source/blender/python/intern/bpy_app_handlers.cc @@ -13,6 +13,8 @@ #include "BLI_utildefines.h" #include +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ + #include "BKE_callbacks.hh" #include "RNA_access.hh" @@ -270,7 +272,7 @@ PyObject *BPY_app_handlers_struct() BlenderAppCbType.tp_init = nullptr; BlenderAppCbType.tp_new = nullptr; /* Without this we can't do `set(sys.modules)` #29635. */ - BlenderAppCbType.tp_hash = (hashfunc)_Py_HashPointer; + BlenderAppCbType.tp_hash = (hashfunc)Py_HashPointer; /* assign the C callbacks */ if (ret) { diff --git a/source/blender/python/intern/bpy_app_icons.cc b/source/blender/python/intern/bpy_app_icons.cc index 07c9f222918..706c1f17128 100644 --- a/source/blender/python/intern/bpy_app_icons.cc +++ b/source/blender/python/intern/bpy_app_icons.cc @@ -15,7 +15,7 @@ #include "BKE_icons.h" #include "../generic/py_capi_utils.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ #include "bpy_app_icons.hh" diff --git a/source/blender/python/intern/bpy_app_ocio.cc b/source/blender/python/intern/bpy_app_ocio.cc index 95d9e872189..8f086324eaf 100644 --- a/source/blender/python/intern/bpy_app_ocio.cc +++ b/source/blender/python/intern/bpy_app_ocio.cc @@ -9,6 +9,8 @@ #include "BLI_utildefines.h" #include +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ + #include "bpy_app_ocio.hh" #include "../generic/py_capi_utils.hh" @@ -84,7 +86,7 @@ PyObject *BPY_app_ocio_struct() BlenderAppOCIOType.tp_init = nullptr; BlenderAppOCIOType.tp_new = nullptr; /* Without this we can't do `set(sys.modules)` #29635. */ - BlenderAppOCIOType.tp_hash = (hashfunc)_Py_HashPointer; + BlenderAppOCIOType.tp_hash = (hashfunc)Py_HashPointer; return ret; } diff --git a/source/blender/python/intern/bpy_app_oiio.cc b/source/blender/python/intern/bpy_app_oiio.cc index 5722864bcb7..fcfbae074a1 100644 --- a/source/blender/python/intern/bpy_app_oiio.cc +++ b/source/blender/python/intern/bpy_app_oiio.cc @@ -9,6 +9,8 @@ #include "BLI_utildefines.h" #include +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ + #include "bpy_app_oiio.hh" #include "../generic/py_capi_utils.hh" @@ -74,7 +76,7 @@ PyObject *BPY_app_oiio_struct() BlenderAppOIIOType.tp_init = nullptr; BlenderAppOIIOType.tp_new = nullptr; /* Without this we can't do `set(sys.modules)` #29635. */ - BlenderAppOIIOType.tp_hash = (hashfunc)_Py_HashPointer; + BlenderAppOIIOType.tp_hash = (hashfunc)Py_HashPointer; return ret; } diff --git a/source/blender/python/intern/bpy_app_opensubdiv.cc b/source/blender/python/intern/bpy_app_opensubdiv.cc index 9f82b4870c9..832b101802c 100644 --- a/source/blender/python/intern/bpy_app_opensubdiv.cc +++ b/source/blender/python/intern/bpy_app_opensubdiv.cc @@ -9,6 +9,8 @@ #include "BLI_utildefines.h" #include +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ + #include "bpy_app_opensubdiv.hh" #include "../generic/py_capi_utils.hh" @@ -85,7 +87,7 @@ PyObject *BPY_app_opensubdiv_struct() BlenderAppOpenSubdivType.tp_init = nullptr; BlenderAppOpenSubdivType.tp_new = nullptr; /* Without this we can't do `set(sys.modules)` #29635. */ - BlenderAppOpenSubdivType.tp_hash = (hashfunc)_Py_HashPointer; + BlenderAppOpenSubdivType.tp_hash = (hashfunc)Py_HashPointer; return ret; } diff --git a/source/blender/python/intern/bpy_app_openvdb.cc b/source/blender/python/intern/bpy_app_openvdb.cc index e0cde7e95d6..e34447984ae 100644 --- a/source/blender/python/intern/bpy_app_openvdb.cc +++ b/source/blender/python/intern/bpy_app_openvdb.cc @@ -9,6 +9,8 @@ #include "BLI_utildefines.h" #include +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ + #include "bpy_app_openvdb.hh" #include "../generic/py_capi_utils.hh" @@ -89,7 +91,7 @@ PyObject *BPY_app_openvdb_struct() BlenderAppOVDBType.tp_init = nullptr; BlenderAppOVDBType.tp_new = nullptr; /* Without this we can't do `set(sys.modules)` #29635. */ - BlenderAppOVDBType.tp_hash = (hashfunc)_Py_HashPointer; + BlenderAppOVDBType.tp_hash = (hashfunc)Py_HashPointer; return ret; } diff --git a/source/blender/python/intern/bpy_app_sdl.cc b/source/blender/python/intern/bpy_app_sdl.cc index b86ce4e34ab..7ea7a5e37d3 100644 --- a/source/blender/python/intern/bpy_app_sdl.cc +++ b/source/blender/python/intern/bpy_app_sdl.cc @@ -9,6 +9,8 @@ #include "BLI_utildefines.h" #include +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ + #include "bpy_app_sdl.hh" #include "../generic/py_capi_utils.hh" @@ -101,7 +103,7 @@ PyObject *BPY_app_sdl_struct() BlenderAppSDLType.tp_init = nullptr; BlenderAppSDLType.tp_new = nullptr; /* Without this we can't do `set(sys.modules)` #29635. */ - BlenderAppSDLType.tp_hash = (hashfunc)_Py_HashPointer; + BlenderAppSDLType.tp_hash = (hashfunc)Py_HashPointer; return ret; } diff --git a/source/blender/python/intern/bpy_app_timers.cc b/source/blender/python/intern/bpy_app_timers.cc index c17cbd1255c..a4b4cc90e4f 100644 --- a/source/blender/python/intern/bpy_app_timers.cc +++ b/source/blender/python/intern/bpy_app_timers.cc @@ -14,7 +14,7 @@ #include "bpy_app_timers.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ static double handle_returned_value(PyObject *function, PyObject *ret) { diff --git a/source/blender/python/intern/bpy_app_translations.cc b/source/blender/python/intern/bpy_app_translations.cc index 86887feb12f..1ed9b3fa1cc 100644 --- a/source/blender/python/intern/bpy_app_translations.cc +++ b/source/blender/python/intern/bpy_app_translations.cc @@ -11,9 +11,12 @@ */ #include + /* XXX Why bloody hell isn't that included in Python.h???? */ #include +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ + #include "BLI_utildefines.h" #include "BPY_extern.hh" @@ -982,7 +985,7 @@ PyObject *BPY_app_translations_struct() /* prevent user from creating new instances */ BlenderAppTranslationsType.tp_new = nullptr; /* Without this we can't do `set(sys.modules)` #29635. */ - BlenderAppTranslationsType.tp_hash = (hashfunc)_Py_HashPointer; + BlenderAppTranslationsType.tp_hash = (hashfunc)Py_HashPointer; return ret; } diff --git a/source/blender/python/intern/bpy_app_usd.cc b/source/blender/python/intern/bpy_app_usd.cc index 3cb9fc7e696..9cbf4e5e599 100644 --- a/source/blender/python/intern/bpy_app_usd.cc +++ b/source/blender/python/intern/bpy_app_usd.cc @@ -9,6 +9,8 @@ #include "BLI_utildefines.h" #include +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ + #include "bpy_app_usd.hh" #include "../generic/py_capi_utils.hh" @@ -87,7 +89,7 @@ PyObject *BPY_app_usd_struct() BlenderAppUSDType.tp_init = nullptr; BlenderAppUSDType.tp_new = nullptr; /* Without this we can't do `set(sys.modules)` #29635. */ - BlenderAppUSDType.tp_hash = (hashfunc)_Py_HashPointer; + BlenderAppUSDType.tp_hash = (hashfunc)Py_HashPointer; return ret; } diff --git a/source/blender/python/intern/bpy_cli_command.cc b/source/blender/python/intern/bpy_cli_command.cc index 5ad0aea9abe..1ef976928dd 100644 --- a/source/blender/python/intern/bpy_cli_command.cc +++ b/source/blender/python/intern/bpy_cli_command.cc @@ -16,7 +16,7 @@ #include "BKE_blender_cli_command.hh" #include "../generic/py_capi_utils.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ #include "bpy_cli_command.hh" /* Own include. */ diff --git a/source/blender/python/intern/bpy_driver.cc b/source/blender/python/intern/bpy_driver.cc index f1a8a80aa29..bbbc65a5973 100644 --- a/source/blender/python/intern/bpy_driver.cc +++ b/source/blender/python/intern/bpy_driver.cc @@ -326,7 +326,9 @@ static bool is_opcode_secure(const int opcode) OK_OP(UNARY_NEGATIVE) OK_OP(UNARY_NOT) OK_OP(UNARY_INVERT) - OK_OP(BINARY_SUBSCR) +# if PY_VERSION_HEX < 0x030e0000 + OK_OP(BINARY_SUBSCR) /* Replaced with existing `BINARY_OP`. */ +# endif OK_OP(GET_LEN) # if PY_VERSION_HEX < 0x030c0000 OK_OP(LIST_TO_TUPLE) diff --git a/source/blender/python/intern/bpy_gizmo_wrap.cc b/source/blender/python/intern/bpy_gizmo_wrap.cc index dbad3ce4b10..93c9365d3a9 100644 --- a/source/blender/python/intern/bpy_gizmo_wrap.cc +++ b/source/blender/python/intern/bpy_gizmo_wrap.cc @@ -27,7 +27,7 @@ #include "bpy_rna.hh" #include "../generic/py_capi_rna.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ /* we may want to add, but not now */ diff --git a/source/blender/python/intern/bpy_interface.cc b/source/blender/python/intern/bpy_interface.cc index 0819d1ce263..5fafdeb98b4 100644 --- a/source/blender/python/intern/bpy_interface.cc +++ b/source/blender/python/intern/bpy_interface.cc @@ -16,6 +16,7 @@ #ifdef WITH_PYTHON_MODULE # include "pylifecycle.h" /* For `Py_Version`. */ #endif +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ #include "CLG_log.h" @@ -647,7 +648,7 @@ void BPY_python_backtrace(FILE *fp) fputs("\n# Python backtrace\n", fp); /* Can happen in rare cases. */ - if (!_PyThreadState_UncheckedGet()) { + if (!PyThreadState_GetUnchecked()) { return; } PyFrameObject *frame = PyEval_GetFrame(); diff --git a/source/blender/python/intern/bpy_library_load.cc b/source/blender/python/intern/bpy_library_load.cc index ea822d9ab54..3c734fcdcb6 100644 --- a/source/blender/python/intern/bpy_library_load.cc +++ b/source/blender/python/intern/bpy_library_load.cc @@ -36,7 +36,7 @@ #include "bpy_library.hh" #include "../generic/py_capi_utils.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ #include "../generic/python_utildefines.hh" /* nifty feature. swap out strings for RNA data */ diff --git a/source/blender/python/intern/bpy_library_write.cc b/source/blender/python/intern/bpy_library_write.cc index 1a0a8b0882d..dcf1bfe0dee 100644 --- a/source/blender/python/intern/bpy_library_write.cc +++ b/source/blender/python/intern/bpy_library_write.cc @@ -30,7 +30,7 @@ #include "bpy_rna.hh" #include "../generic/py_capi_utils.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ using namespace blender::bke::blendfile; diff --git a/source/blender/python/intern/bpy_msgbus.cc b/source/blender/python/intern/bpy_msgbus.cc index 7d24bb9ec7f..7be3675babb 100644 --- a/source/blender/python/intern/bpy_msgbus.cc +++ b/source/blender/python/intern/bpy_msgbus.cc @@ -11,7 +11,7 @@ #include "../generic/py_capi_rna.hh" #include "../generic/py_capi_utils.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ #include "../generic/python_utildefines.hh" #include "../mathutils/mathutils.hh" diff --git a/source/blender/python/intern/bpy_operator.cc b/source/blender/python/intern/bpy_operator.cc index e4c0b3546f1..7486a920fbb 100644 --- a/source/blender/python/intern/bpy_operator.cc +++ b/source/blender/python/intern/bpy_operator.cc @@ -21,7 +21,7 @@ #include "../generic/py_capi_rna.hh" #include "../generic/py_capi_utils.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ #include "BPY_extern.hh" #include "bpy_capi_utils.hh" diff --git a/source/blender/python/intern/bpy_props.cc b/source/blender/python/intern/bpy_props.cc index 99967aec7c2..63a486cad73 100644 --- a/source/blender/python/intern/bpy_props.cc +++ b/source/blender/python/intern/bpy_props.cc @@ -38,7 +38,7 @@ #include "../generic/py_capi_rna.hh" #include "../generic/py_capi_utils.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ using blender::Array; diff --git a/source/blender/python/intern/bpy_rna.cc b/source/blender/python/intern/bpy_rna.cc index a92b370f979..b41e3a7e612 100644 --- a/source/blender/python/intern/bpy_rna.cc +++ b/source/blender/python/intern/bpy_rna.cc @@ -69,7 +69,7 @@ #include "../generic/idprop_py_ui_api.hh" #include "../generic/py_capi_rna.hh" #include "../generic/py_capi_utils.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ #include "../generic/python_utildefines.hh" #define USE_PEDANTIC_WRITE @@ -1163,7 +1163,7 @@ static PyObject *pyrna_func_repr(BPy_FunctionRNA *self) static Py_hash_t pyrna_struct_hash(BPy_StructRNA *self) { - return _Py_HashPointer(self->ptr->data); + return Py_HashPointer(self->ptr->data); } /* From Python's meth_hash v3.1.2. */ @@ -1174,12 +1174,12 @@ static long pyrna_prop_hash(BPy_PropertyRNA *self) x = 0; } else { - x = _Py_HashPointer(self->ptr->data); + x = Py_HashPointer(self->ptr->data); if (x == -1) { return -1; } } - y = _Py_HashPointer((void *)(self->prop)); + y = Py_HashPointer((void *)(self->prop)); if (y == -1) { return -1; } diff --git a/source/blender/python/intern/bpy_rna_context.cc b/source/blender/python/intern/bpy_rna_context.cc index 3e314894cda..0a6f2d44954 100644 --- a/source/blender/python/intern/bpy_rna_context.cc +++ b/source/blender/python/intern/bpy_rna_context.cc @@ -23,7 +23,7 @@ #include "bpy_rna_context.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ #include "RNA_access.hh" #include "RNA_prototypes.hh" diff --git a/source/blender/python/intern/bpy_rna_data.cc b/source/blender/python/intern/bpy_rna_data.cc index 7f1b8531866..5d235ef0797 100644 --- a/source/blender/python/intern/bpy_rna_data.cc +++ b/source/blender/python/intern/bpy_rna_data.cc @@ -17,7 +17,7 @@ #include #include "../generic/py_capi_utils.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ #include "BLI_string.h" diff --git a/source/blender/python/intern/bpy_rna_gizmo.cc b/source/blender/python/intern/bpy_rna_gizmo.cc index 50aa4b5bc31..b9b3fb1af2c 100644 --- a/source/blender/python/intern/bpy_rna_gizmo.cc +++ b/source/blender/python/intern/bpy_rna_gizmo.cc @@ -22,7 +22,7 @@ #include "bpy_rna_gizmo.hh" #include "../generic/py_capi_utils.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ #include "RNA_access.hh" #include "RNA_prototypes.hh" diff --git a/source/blender/python/intern/bpy_rna_id_collection.cc b/source/blender/python/intern/bpy_rna_id_collection.cc index 6933e9ef289..7319303d31d 100644 --- a/source/blender/python/intern/bpy_rna_id_collection.cc +++ b/source/blender/python/intern/bpy_rna_id_collection.cc @@ -32,7 +32,7 @@ #include "../generic/py_capi_rna.hh" #include "../generic/py_capi_utils.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ #include "RNA_enum_types.hh" #include "RNA_prototypes.hh" diff --git a/source/blender/python/intern/bpy_rna_text.cc b/source/blender/python/intern/bpy_rna_text.cc index 2eb8e3e0cfc..be92cae76ee 100644 --- a/source/blender/python/intern/bpy_rna_text.cc +++ b/source/blender/python/intern/bpy_rna_text.cc @@ -18,7 +18,7 @@ #include "BKE_text.h" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ #include "bpy_rna.hh" #include "bpy_rna_text.hh" /* Declare #BPY_rna_region_as_string_method_def. */ diff --git a/source/blender/python/intern/bpy_utils_units.cc b/source/blender/python/intern/bpy_utils_units.cc index 5c226022bb1..e67d2e2d177 100644 --- a/source/blender/python/intern/bpy_utils_units.cc +++ b/source/blender/python/intern/bpy_utils_units.cc @@ -21,7 +21,7 @@ #include "bpy_utils_units.hh" #include "../generic/py_capi_utils.hh" -#include "../generic/python_compat.hh" +#include "../generic/python_compat.hh" /* IWYU pragma: keep. */ #include "BKE_unit.hh"