From 1684ed6537fbd91ae5c14fb0314564e71799d390 Mon Sep 17 00:00:00 2001 From: Leo Famulari Date: Sun, 9 Jan 2022 16:34:12 -0500 Subject: gnu: Remove leftover patches for Blender 2.79. This is a followup to commit 23da063ea3bb6a579f0fb87d2e5e00fed9962775. * gnu/packages/patches/blender-2.79-gcc8.patch, gnu/packages/patches/blender-2.79-gcc9.patch, gnu/packages/patches/blender-2.79-newer-ffmpeg.patch, gnu/packages/patches/blender-2.79-oiio2.patch, gnu/packages/patches/blender-2.79-python-3.7-fix.patch, gnu/packages/patches/blender-2.79-python-3.8-fix.patch: Delete files. * gnu/local.mk (dist_patch_DATA): Remove them. --- gnu/packages/patches/blender-2.79-gcc8.patch | 36 --- gnu/packages/patches/blender-2.79-gcc9.patch | 53 ---- .../patches/blender-2.79-newer-ffmpeg.patch | 80 ------ gnu/packages/patches/blender-2.79-oiio2.patch | 284 --------------------- .../patches/blender-2.79-python-3.7-fix.patch | 43 ---- .../patches/blender-2.79-python-3.8-fix.patch | 204 --------------- 6 files changed, 700 deletions(-) delete mode 100644 gnu/packages/patches/blender-2.79-gcc8.patch delete mode 100644 gnu/packages/patches/blender-2.79-gcc9.patch delete mode 100644 gnu/packages/patches/blender-2.79-newer-ffmpeg.patch delete mode 100644 gnu/packages/patches/blender-2.79-oiio2.patch delete mode 100644 gnu/packages/patches/blender-2.79-python-3.7-fix.patch delete mode 100644 gnu/packages/patches/blender-2.79-python-3.8-fix.patch (limited to 'gnu/packages/patches') diff --git a/gnu/packages/patches/blender-2.79-gcc8.patch b/gnu/packages/patches/blender-2.79-gcc8.patch deleted file mode 100644 index 6a9186323b..0000000000 --- a/gnu/packages/patches/blender-2.79-gcc8.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff --git a/intern/itasc/kdl/tree.hpp b/intern/itasc/kdl/tree.hpp -index c8a253fc901..bd35f82d185 100644 ---- a/intern/itasc/kdl/tree.hpp -+++ b/intern/itasc/kdl/tree.hpp -@@ -34,7 +34,7 @@ namespace KDL - //Forward declaration - class TreeElement; - // Eigen allocator is needed for alignment of Eigen data types -- typedef std::map, Eigen::aligned_allocator > > SegmentMap; -+ typedef std::map, Eigen::aligned_allocator > > SegmentMap; - - class TreeElement - { -diff --git a/intern/cycles/util/util_sseb.h b/intern/cycles/util/util_sseb.h -index 6e669701f3b..977976c3fc0 100644 ---- a/intern/cycles/util/util_sseb.h -+++ b/intern/cycles/util/util_sseb.h -@@ -22,6 +22,9 @@ CCL_NAMESPACE_BEGIN - - #ifdef __KERNEL_SSE2__ - -+struct ssei; -+struct ssef; -+ - /*! 4-wide SSE bool type. */ - struct sseb - { -@@ -116,7 +119,7 @@ __forceinline const sseb unpacklo( const sseb& a, const sseb& b ) { return _mm_u - __forceinline const sseb unpackhi( const sseb& a, const sseb& b ) { return _mm_unpackhi_ps(a, b); } - - template __forceinline const sseb shuffle( const sseb& a ) { -- return _mm_shuffle_epi32(a, _MM_SHUFFLE(i3, i2, i1, i0)); -+ return _mm_castsi128_ps(_mm_shuffle_epi32(a, _MM_SHUFFLE(i3, i2, i1, i0))); - } - - template<> __forceinline const sseb shuffle<0, 1, 0, 1>( const sseb& a ) { diff --git a/gnu/packages/patches/blender-2.79-gcc9.patch b/gnu/packages/patches/blender-2.79-gcc9.patch deleted file mode 100644 index d538a02620..0000000000 --- a/gnu/packages/patches/blender-2.79-gcc9.patch +++ /dev/null @@ -1,53 +0,0 @@ -commit e6d803fd4a383cecf8c643095f093a31c944b785 -Author: Robert-André Mauchin -Date: Wed Apr 3 01:36:52 2019 +0200 - - Fix for GCC9 new OpenMP data sharing - - GCC 9 started implementing the OpenMP 4.0 and later behavior. When not using - default clause or when using default(shared), this makes no difference, but - if using default(none), previously the choice was not specify the const - qualified variables on the construct at all, or specify in firstprivate - clause. In GCC 9 as well as for OpenMP 4.0 compliance, those variables need - to be specified on constructs in which they are used, either in shared or - in firstprivate clause. Specifying them in firstprivate clause is one way to - achieve compatibility with both older GCC versions and GCC 9, - another option is to drop the default(none) clause. - - This patch thus drops the default(none) clause. - - See https://gcc.gnu.org/gcc-9/porting_to.html#ompdatasharing - - Signed-off-by: Robert-André Mauchin - -diff --git a/intern/elbeem/intern/solver_main.cpp b/intern/elbeem/intern/solver_main.cpp -index 68f7c04cd54..514087b6130 100644 ---- a/intern/elbeem/intern/solver_main.cpp -+++ b/intern/elbeem/intern/solver_main.cpp -@@ -381,7 +381,7 @@ LbmFsgrSolver::mainLoop(const int lev) - GRID_REGION_INIT(); - #if PARALLEL==1 - const int gDebugLevel = ::gDebugLevel; --#pragma omp parallel default(none) num_threads(mNumOMPThreads) \ -+#pragma omp parallel num_threads(mNumOMPThreads) \ - reduction(+: \ - calcCurrentMass,calcCurrentVolume, \ - calcCellsFilled,calcCellsEmptied, \ -@@ -1126,7 +1126,7 @@ LbmFsgrSolver::preinitGrids() - GRID_REGION_INIT(); - #if PARALLEL==1 - const int gDebugLevel = ::gDebugLevel; --#pragma omp parallel default(none) num_threads(mNumOMPThreads) \ -+#pragma omp parallel num_threads(mNumOMPThreads) \ - reduction(+: \ - calcCurrentMass,calcCurrentVolume, \ - calcCellsFilled,calcCellsEmptied, \ -@@ -1164,7 +1164,7 @@ LbmFsgrSolver::standingFluidPreinit() - GRID_REGION_INIT(); - #if PARALLEL==1 - const int gDebugLevel = ::gDebugLevel; --#pragma omp parallel default(none) num_threads(mNumOMPThreads) \ -+#pragma omp parallel num_threads(mNumOMPThreads) \ - reduction(+: \ - calcCurrentMass,calcCurrentVolume, \ - calcCellsFilled,calcCellsEmptied, \ diff --git a/gnu/packages/patches/blender-2.79-newer-ffmpeg.patch b/gnu/packages/patches/blender-2.79-newer-ffmpeg.patch deleted file mode 100644 index 363489bc70..0000000000 --- a/gnu/packages/patches/blender-2.79-newer-ffmpeg.patch +++ /dev/null @@ -1,80 +0,0 @@ -https://sources.debian.org/data/main/b/blender/2.79.b+dfsg0-4/debian/patches/0008-fix_building_with_latest_versions_of_FFmpeg.patch - -From: Bastien Montagne -Date: Tue, 8 May 2018 16:00:52 +0200 -Subject: fix_building_with_latest_versions_of_FFmpeg - -Some years-old deprecated stuff has now been removed. - -Correct solution is probably to use valid defines etc. in own code, but -this is more FFMEPG maintainer task (since it also may change how old -FFMPEG we do support...). ---- - intern/ffmpeg/ffmpeg_compat.h | 39 ++++++++++++++++++++++++++ - source/blender/blenkernel/intern/writeffmpeg.c | 3 +- - 2 files changed, 41 insertions(+), 1 deletion(-) - -diff --git a/intern/ffmpeg/ffmpeg_compat.h b/intern/ffmpeg/ffmpeg_compat.h -index 9c06c8a..f7f437c 100644 ---- a/intern/ffmpeg/ffmpeg_compat.h -+++ b/intern/ffmpeg/ffmpeg_compat.h -@@ -109,6 +109,45 @@ int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt) - - #endif - -+/* XXX TODO Probably fix to correct modern flags in code? Not sure how old FFMPEG we want to support though, -+ * so for now this will do. */ -+ -+#ifndef FF_MIN_BUFFER_SIZE -+# ifdef AV_INPUT_BUFFER_MIN_SIZE -+# define FF_MIN_BUFFER_SIZE AV_INPUT_BUFFER_MIN_SIZE -+# endif -+#endif -+ -+#ifndef FF_INPUT_BUFFER_PADDING_SIZE -+# ifdef AV_INPUT_BUFFER_PADDING_SIZE -+# define FF_INPUT_BUFFER_PADDING_SIZE AV_INPUT_BUFFER_PADDING_SIZE -+# endif -+#endif -+ -+#ifndef CODEC_FLAG_GLOBAL_HEADER -+# ifdef AV_CODEC_FLAG_GLOBAL_HEADER -+# define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER -+# endif -+#endif -+ -+#ifndef CODEC_FLAG_GLOBAL_HEADER -+# ifdef AV_CODEC_FLAG_GLOBAL_HEADER -+# define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER -+# endif -+#endif -+ -+#ifndef CODEC_FLAG_INTERLACED_DCT -+# ifdef AV_CODEC_FLAG_INTERLACED_DCT -+# define CODEC_FLAG_INTERLACED_DCT AV_CODEC_FLAG_INTERLACED_DCT -+# endif -+#endif -+ -+#ifndef CODEC_FLAG_INTERLACED_ME -+# ifdef AV_CODEC_FLAG_INTERLACED_ME -+# define CODEC_FLAG_INTERLACED_ME AV_CODEC_FLAG_INTERLACED_ME -+# endif -+#endif -+ - /* FFmpeg upstream 1.0 is the first who added AV_ prefix. */ - #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54, 59, 100) - # define AV_CODEC_ID_NONE CODEC_ID_NONE -diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c -index a19e414..04d508a 100644 ---- a/source/blender/blenkernel/intern/writeffmpeg.c -+++ b/source/blender/blenkernel/intern/writeffmpeg.c -@@ -605,7 +605,8 @@ static AVStream *alloc_video_stream(FFMpegContext *context, RenderData *rd, int - c->rc_buffer_aggressivity = 1.0; - #endif - -- c->me_method = ME_EPZS; -+ /* Deprecated and not doing anything since July 2015, deleted in recent ffmpeg */ -+ //c->me_method = ME_EPZS; - - codec = avcodec_find_encoder(c->codec_id); - if (!codec) diff --git a/gnu/packages/patches/blender-2.79-oiio2.patch b/gnu/packages/patches/blender-2.79-oiio2.patch deleted file mode 100644 index 1c3606a940..0000000000 --- a/gnu/packages/patches/blender-2.79-oiio2.patch +++ /dev/null @@ -1,284 +0,0 @@ -From: Sergey Sharybin -Date: Fri, 28 Dec 2018 11:25:35 +0100 -Subject: adapt_build_against_OIIO2 - ---- - intern/cycles/blender/blender_python.cpp | 2 +- - intern/cycles/graph/node_xml.cpp | 2 +- - intern/cycles/render/buffers.cpp | 4 ++-- - intern/cycles/render/image.cpp | 15 ++++-------- - intern/cycles/render/image.h | 3 ++- - intern/cycles/util/util_unique_ptr.h | 28 ++++++++++++++++++++++ - .../blender/imbuf/intern/oiio/openimageio_api.cpp | 19 +++++++-------- - 7 files changed, 48 insertions(+), 25 deletions(-) - create mode 100644 intern/cycles/util/util_unique_ptr.h - -diff --git a/intern/cycles/blender/blender_python.cpp b/intern/cycles/blender/blender_python.cpp -index 54973fd..bee6dd1 100644 ---- a/intern/cycles/blender/blender_python.cpp -+++ b/intern/cycles/blender/blender_python.cpp -@@ -493,7 +493,7 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args) - socket_type = "NodeSocketString"; - data_type = BL::NodeSocket::type_STRING; - if(param->validdefault) -- default_string = param->sdefault[0]; -+ default_string = param->sdefault[0].string(); - } - else - continue; -diff --git a/intern/cycles/graph/node_xml.cpp b/intern/cycles/graph/node_xml.cpp -index d26b3b2..2a24104 100644 ---- a/intern/cycles/graph/node_xml.cpp -+++ b/intern/cycles/graph/node_xml.cpp -@@ -250,7 +250,7 @@ void xml_read_node(XMLReader& reader, Node *node, xml_node xml_node) - } - } - -- if(node->name) -+ if(!node->name.empty()) - reader.node_map[node->name] = node; - } - -diff --git a/intern/cycles/render/buffers.cpp b/intern/cycles/render/buffers.cpp -index cf402c3..f84a37a 100644 ---- a/intern/cycles/render/buffers.cpp -+++ b/intern/cycles/render/buffers.cpp -@@ -27,6 +27,7 @@ - #include "util/util_opengl.h" - #include "util/util_time.h" - #include "util/util_types.h" -+#include "util/util_unique_ptr.h" - - CCL_NAMESPACE_BEGIN - -@@ -453,7 +454,7 @@ void DisplayBuffer::write(Device *device, const string& filename) - device->pixels_copy_from(rgba, 0, w, h); - - /* write image */ -- ImageOutput *out = ImageOutput::create(filename); -+ unique_ptr out = unique_ptr(ImageOutput::create(filename)); - ImageSpec spec(w, h, 4, TypeDesc::UINT8); - int scanlinesize = w*4*sizeof(uchar); - -@@ -468,7 +469,6 @@ void DisplayBuffer::write(Device *device, const string& filename) - - out->close(); - -- delete out; - } - - device_memory& DisplayBuffer::rgba_data() -diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp -index 595eb46..a143b02 100644 ---- a/intern/cycles/render/image.cpp -+++ b/intern/cycles/render/image.cpp -@@ -23,6 +23,7 @@ - #include "util/util_path.h" - #include "util/util_progress.h" - #include "util/util_texture.h" -+#include "util/util_unique_ptr.h" - - #ifdef WITH_OSL - #include -@@ -148,7 +149,7 @@ ImageDataType ImageManager::get_image_metadata(const string& filename, - return IMAGE_DATA_TYPE_BYTE4; - } - -- ImageInput *in = ImageInput::create(filename); -+ unique_ptr in(ImageInput::create(filename)); - - if(in) { - ImageSpec spec; -@@ -194,7 +195,6 @@ ImageDataType ImageManager::get_image_metadata(const string& filename, - in->close(); - } - -- delete in; - } - - if(is_half) { -@@ -449,7 +449,7 @@ void ImageManager::tag_reload_image(const string& filename, - } - - bool ImageManager::file_load_image_generic(Image *img, -- ImageInput **in, -+ unique_ptr *in, - int &width, - int &height, - int &depth, -@@ -465,7 +465,7 @@ bool ImageManager::file_load_image_generic(Image *img, - } - - /* load image from file through OIIO */ -- *in = ImageInput::create(img->filename); -+ *in = unique_ptr(ImageInput::create(img->filename)); - - if(!*in) - return false; -@@ -477,8 +477,6 @@ bool ImageManager::file_load_image_generic(Image *img, - config.attribute("oiio:UnassociatedAlpha", 1); - - if(!(*in)->open(img->filename, spec, config)) { -- delete *in; -- *in = NULL; - return false; - } - -@@ -500,8 +498,6 @@ bool ImageManager::file_load_image_generic(Image *img, - if(!(components >= 1 && components <= 4)) { - if(*in) { - (*in)->close(); -- delete *in; -- *in = NULL; - } - - return false; -@@ -519,7 +515,7 @@ bool ImageManager::file_load_image(Image *img, - device_vector& tex_img) - { - const StorageType alpha_one = (FileFormat == TypeDesc::UINT8)? 255 : 1; -- ImageInput *in = NULL; -+ unique_ptr in = NULL; - int width, height, depth, components; - if(!file_load_image_generic(img, &in, width, height, depth, components)) { - return false; -@@ -575,7 +571,6 @@ bool ImageManager::file_load_image(Image *img, - } - cmyk = strcmp(in->format_name(), "jpeg") == 0 && components == 4; - in->close(); -- delete in; - } - else { - if(FileFormat == TypeDesc::FLOAT) { -diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h -index db7e28a..f4a14f4 100644 ---- a/intern/cycles/render/image.h -+++ b/intern/cycles/render/image.h -@@ -23,6 +23,7 @@ - #include "util/util_image.h" - #include "util/util_string.h" - #include "util/util_thread.h" -+#include "util/util_unique_ptr.h" - #include "util/util_vector.h" - - CCL_NAMESPACE_BEGIN -@@ -133,7 +134,7 @@ private: - bool pack_images; - - bool file_load_image_generic(Image *img, -- ImageInput **in, -+ unique_ptr *in, - int &width, - int &height, - int &depth, -diff --git a/intern/cycles/util/util_unique_ptr.h b/intern/cycles/util/util_unique_ptr.h -new file mode 100644 -index 0000000..1ceae73 ---- /dev/null -+++ b/intern/cycles/util/util_unique_ptr.h -@@ -0,0 +1,28 @@ -+/* -+ * Copyright 2011-2013 Blender Foundation -+ * -+ * Licensed under the Apache License, Version 2.0 (the "License"); -+ * you may not use this file except in compliance with the License. -+ * You may obtain a copy of the License at -+ * -+ * http://www.apache.org/licenses/LICENSE-2.0 -+ * -+ * Unless required by applicable law or agreed to in writing, software -+ * distributed under the License is distributed on an "AS IS" BASIS, -+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+ * See the License for the specific language governing permissions and -+ * limitations under the License. -+ */ -+ -+#ifndef __UTIL_UNIQUE_PTR_H__ -+#define __UTIL_UNIQUE_PTR_H__ -+ -+#include -+ -+CCL_NAMESPACE_BEGIN -+ -+using std::unique_ptr; -+ -+CCL_NAMESPACE_END -+ -+#endif /* __UTIL_UNIQUE_PTR_H__ */ -diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.cpp b/source/blender/imbuf/intern/oiio/openimageio_api.cpp -index b123d50..7f2fac9 100644 ---- a/source/blender/imbuf/intern/oiio/openimageio_api.cpp -+++ b/source/blender/imbuf/intern/oiio/openimageio_api.cpp -@@ -35,6 +35,11 @@ - #include "utfconv.h" - #endif - -+// NOTE: Keep first, BLI_path_util conflicts with OIIO's format. -+#include -+#include -+#include -+ - extern "C" - { - #include "MEM_guardedalloc.h" -@@ -48,12 +53,10 @@ extern "C" - #include "IMB_colormanagement_intern.h" - } - --#include --#include -- - OIIO_NAMESPACE_USING - - using std::string; -+using std::unique_ptr; - - typedef unsigned char uchar; - -@@ -197,7 +200,6 @@ int imb_save_photoshop(struct ImBuf *ibuf, const char * /*name*/, int flags) - - struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspace[IM_MAX_SPACE]) - { -- ImageInput *in = NULL; - struct ImBuf *ibuf = NULL; - int width, height, components; - bool is_float, is_alpha; -@@ -210,7 +212,7 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac - - colorspace_set_default_role(colorspace, IM_MAX_SPACE, COLOR_ROLE_DEFAULT_BYTE); - -- in = ImageInput::create(filename); -+ unique_ptr in(ImageInput::create(filename)); - if (!in) { - std::cerr << __func__ << ": ImageInput::create() failed:" << std::endl - << OIIO_NAMESPACE::geterror() << std::endl; -@@ -223,7 +225,6 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac - if (!in->open(filename, spec, config)) { - std::cerr << __func__ << ": ImageInput::open() failed:" << std::endl - << in->geterror() << std::endl; -- delete in; - return NULL; - } - -@@ -249,19 +250,17 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac - if (!(components >= 1 && components <= 4)) { - if (in) { - in->close(); -- delete in; - } - return NULL; - } - - if (is_float) -- ibuf = imb_oiio_load_image_float(in, width, height, components, flags, is_alpha); -+ ibuf = imb_oiio_load_image_float(in.get(), width, height, components, flags, is_alpha); - else -- ibuf = imb_oiio_load_image(in, width, height, components, flags, is_alpha); -+ ibuf = imb_oiio_load_image(in.get(), width, height, components, flags, is_alpha); - - if (in) { - in->close(); -- delete in; - } - - if (!ibuf) diff --git a/gnu/packages/patches/blender-2.79-python-3.7-fix.patch b/gnu/packages/patches/blender-2.79-python-3.7-fix.patch deleted file mode 100644 index fd1d8ba437..0000000000 --- a/gnu/packages/patches/blender-2.79-python-3.7-fix.patch +++ /dev/null @@ -1,43 +0,0 @@ -Copied from https://git.blender.org/gitweb/gitweb.cgi/blender.git/patch/1db47a2ccd1e68994bf8140eba6cc2a26a2bc91f -Fixes . - -From 1db47a2ccd1e68994bf8140eba6cc2a26a2bc91f Mon Sep 17 00:00:00 2001 -From: Campbell Barton -Date: Thu, 12 Jul 2018 08:28:06 +0200 -Subject: [PATCH] Fix PyRNA class registration w/ Python 3.7 - -In Python3.7 this now raises an error. ---- - source/blender/python/intern/bpy_rna.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c -index 9052b6f580a..80b0aa7a51b 100644 ---- a/source/blender/python/intern/bpy_rna.c -+++ b/source/blender/python/intern/bpy_rna.c -@@ -7577,10 +7577,12 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr, StructRNA *srna, v - if (!(flag & PROP_REGISTER)) - continue; - -+ /* TODO(campbell): Use Python3.7x _PyObject_LookupAttr(), also in the macro below. */ - identifier = RNA_property_identifier(prop); - item = PyObject_GetAttrString(py_class, identifier); - - if (item == NULL) { -+ PyErr_Clear(); - /* Sneaky workaround to use the class name as the bl_idname */ - - #define BPY_REPLACEMENT_STRING(rna_attr, py_attr) \ -@@ -7596,6 +7598,9 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr, StructRNA *srna, v - } \ - Py_DECREF(item); \ - } \ -+ else { \ -+ PyErr_Clear(); \ -+ } \ - } /* intentionally allow else here */ - - if (false) {} /* needed for macro */ --- -2.20.1 - diff --git a/gnu/packages/patches/blender-2.79-python-3.8-fix.patch b/gnu/packages/patches/blender-2.79-python-3.8-fix.patch deleted file mode 100644 index 18d25449ee..0000000000 --- a/gnu/packages/patches/blender-2.79-python-3.8-fix.patch +++ /dev/null @@ -1,204 +0,0 @@ -From 4b663ecf264020b1d7003a137ce84b06d7ec4ce6 Mon Sep 17 00:00:00 2001 -From: bartus -Date: Sat, 16 Nov 2019 20:29:30 +0100 -Subject: [PATCH] Add python 3.8 support. - ---- - source/blender/python/generic/py_capi_utils.c | 27 +++++++++++++++---- - 1 file changed, 22 insertions(+), 5 deletions(-) - -diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c -index 545e0506f84..a7eab70600b 100644 ---- a/source/blender/python/generic/py_capi_utils.c -+++ b/source/blender/python/generic/py_capi_utils.c -@@ -696,9 +696,16 @@ PyObject *PyC_UnicodeFromByte(const char *str) - ****************************************************************************/ - PyObject *PyC_DefaultNameSpace(const char *filename) - { -+ #if PY_VERSION_HEX >= 0x03080000 -+ PyObject *modules = PyImport_GetModuleDict(); -+ PyObject *builtins = PyEval_GetBuiltins(); -+ #else - PyInterpreterState *interp = PyThreadState_GET()->interp; -+ PyObject *modules = interp->modules; -+ PyObject *builtins = interp->builtins; -+ #endif - PyObject *mod_main = PyModule_New("__main__"); -- PyDict_SetItemString(interp->modules, "__main__", mod_main); -+ PyDict_SetItemString(modules, "__main__", mod_main); - Py_DECREF(mod_main); /* sys.modules owns now */ - PyModule_AddStringConstant(mod_main, "__name__", "__main__"); - if (filename) { -@@ -706,8 +713,8 @@ PyObject *PyC_DefaultNameSpace(const char *filename) - * note: this wont map to a real file when executing text-blocks and buttons. */ - PyModule_AddObject(mod_main, "__file__", PyC_UnicodeFromByte(filename)); - } -- PyModule_AddObject(mod_main, "__builtins__", interp->builtins); -- Py_INCREF(interp->builtins); /* AddObject steals a reference */ -+ PyModule_AddObject(mod_main, "__builtins__", builtins); -+ Py_INCREF(builtins); /* AddObject steals a reference */ - return PyModule_GetDict(mod_main); - } - -@@ -734,15 +741,25 @@ bool PyC_NameSpace_ImportArray(PyObject *py_dict, const char *imports[]) - /* restore MUST be called after this */ - void PyC_MainModule_Backup(PyObject **main_mod) - { -+ #if PY_VERSION_HEX >= 0x03080000 -+ PyObject *modules = PyImport_GetModuleDict(); -+ #else - PyInterpreterState *interp = PyThreadState_GET()->interp; -- *main_mod = PyDict_GetItemString(interp->modules, "__main__"); -+ PyObject *modules = interp->modules; -+ #endif -+ *main_mod = PyDict_GetItemString(modules, "__main__"); - Py_XINCREF(*main_mod); /* don't free */ - } - - void PyC_MainModule_Restore(PyObject *main_mod) - { -+ #if PY_VERSION_HEX >= 0x03080000 -+ PyObject *modules = PyImport_GetModuleDict(); -+ #else - PyInterpreterState *interp = PyThreadState_GET()->interp; -- PyDict_SetItemString(interp->modules, "__main__", main_mod); -+ PyObject *modules = interp->modules; -+ #endif -+ PyDict_SetItemString(modules, "__main__", main_mod); - Py_XDECREF(main_mod); - } - --- -2.24.0 - -From 44f719b63238503ef8f933f55383c6d4798995cc Mon Sep 17 00:00:00 2001 -From: Campbell Barton -Date: Thu, 13 Sep 2018 17:06:07 +1000 -Subject: [PATCH] Cleanup: use PyImport_GetModuleDict - -Replace direct access using PyThreadState_GET ---- - source/blender/python/bmesh/bmesh_py_api.c | 2 +- - source/blender/python/generic/idprop_py_api.c | 2 +- - source/blender/python/intern/bpy_interface.c | 2 +- - source/blender/python/intern/gpu.c | 4 ++-- - source/blender/python/mathutils/mathutils.c | 2 +- - source/blender/python/mathutils/mathutils_noise.c | 5 +++-- - source/gameengine/Ketsji/KX_PythonInit.cpp | 2 +- - 7 files changed, 10 insertions(+), 9 deletions(-) - -diff --git a/source/blender/python/bmesh/bmesh_py_api.c b/source/blender/python/bmesh/bmesh_py_api.c -index d5973baeadb..d7324eabb6c 100644 ---- a/source/blender/python/bmesh/bmesh_py_api.c -+++ b/source/blender/python/bmesh/bmesh_py_api.c -@@ -196,7 +196,7 @@ PyObject *BPyInit_bmesh(void) - { - PyObject *mod; - PyObject *submodule; -- PyObject *sys_modules = PyThreadState_GET()->interp->modules; -+ PyObject *sys_modules = PyImport_GetModuleDict(); - - BPy_BM_init_types(); - BPy_BM_init_types_select(); -diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c -index 4d4d5232800..8bed0f28cba 100644 ---- a/source/blender/python/generic/idprop_py_api.c -+++ b/source/blender/python/generic/idprop_py_api.c -@@ -1795,7 +1795,7 @@ PyObject *BPyInit_idprop(void) - { - PyObject *mod; - PyObject *submodule; -- PyObject *sys_modules = PyThreadState_GET()->interp->modules; -+ PyObject *sys_modules = PyImport_GetModuleDict(); - - mod = PyModule_Create(&IDProp_module_def); - -diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c -index 7ca087e4993..123c938b921 100644 ---- a/source/blender/python/intern/bpy_interface.c -+++ b/source/blender/python/intern/bpy_interface.c -@@ -537,7 +537,7 @@ static bool python_script_exec( - - if (py_dict) { - #ifdef PYMODULE_CLEAR_WORKAROUND -- PyModuleObject *mmod = (PyModuleObject *)PyDict_GetItemString(PyThreadState_GET()->interp->modules, "__main__"); -+ PyModuleObject *mmod = (PyModuleObject *)PyDict_GetItemString(PyImport_GetModuleDict(), "__main__"); - PyObject *dict_back = mmod->md_dict; - /* freeing the module will clear the namespace, - * gives problems running classes defined in this namespace being used later. */ -diff --git a/source/blender/python/intern/gpu.c b/source/blender/python/intern/gpu.c -index 43796dc9474..d902b6838f4 100644 ---- a/source/blender/python/intern/gpu.c -+++ b/source/blender/python/intern/gpu.c -@@ -326,7 +326,7 @@ PyObject *GPU_initPython(void) - { - PyObject *module; - PyObject *submodule; -- PyObject *sys_modules = PyThreadState_GET()->interp->modules; -+ PyObject *sys_modules = PyImport_GetModuleDict(); - - module = PyInit_gpu(); - -@@ -337,6 +337,6 @@ PyObject *GPU_initPython(void) - PyDict_SetItem(sys_modules, PyModule_GetNameObject(submodule), submodule); - Py_INCREF(submodule); - -- PyDict_SetItem(PyImport_GetModuleDict(), PyModule_GetNameObject(module), module); -+ PyDict_SetItem(sys_modules, PyModule_GetNameObject(module), module); - return module; - } -diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c -index a3a4e7f313b..f021d456b3a 100644 ---- a/source/blender/python/mathutils/mathutils.c -+++ b/source/blender/python/mathutils/mathutils.c -@@ -615,7 +615,7 @@ PyMODINIT_FUNC PyInit_mathutils(void) - { - PyObject *mod; - PyObject *submodule; -- PyObject *sys_modules = PyThreadState_GET()->interp->modules; -+ PyObject *sys_modules = PyImport_GetModuleDict(); - - if (PyType_Ready(&vector_Type) < 0) - return NULL; -diff --git a/source/blender/python/mathutils/mathutils_noise.c b/source/blender/python/mathutils/mathutils_noise.c -index 839d1ffc588..834322c0aed 100644 ---- a/source/blender/python/mathutils/mathutils_noise.c -+++ b/source/blender/python/mathutils/mathutils_noise.c -@@ -845,6 +845,7 @@ static struct PyModuleDef M_Noise_module_def = { - /*----------------------------MODULE INIT-------------------------*/ - PyMODINIT_FUNC PyInit_mathutils_noise(void) - { -+ PyObject *sys_modules = PyImport_GetModuleDict(); - PyObject *submodule = PyModule_Create(&M_Noise_module_def); - PyObject *item_types, *item_metrics; - -@@ -852,11 +853,11 @@ PyMODINIT_FUNC PyInit_mathutils_noise(void) - setRndSeed(0); - - PyModule_AddObject(submodule, "types", (item_types = PyInit_mathutils_noise_types())); -- PyDict_SetItemString(PyThreadState_GET()->interp->modules, "noise.types", item_types); -+ PyDict_SetItemString(sys_modules, "noise.types", item_types); - Py_INCREF(item_types); - - PyModule_AddObject(submodule, "distance_metrics", (item_metrics = PyInit_mathutils_noise_metrics())); -- PyDict_SetItemString(PyThreadState_GET()->interp->modules, "noise.distance_metrics", item_metrics); -+ PyDict_SetItemString(sys_modules, "noise.distance_metrics", item_metrics); - Py_INCREF(item_metrics); - - return submodule; -diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp -index 251273cf7a8..9611a4ea49b 100644 ---- a/source/gameengine/Ketsji/KX_PythonInit.cpp -+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp -@@ -2234,7 +2234,7 @@ PyMODINIT_FUNC initBGE(void) - { - PyObject *mod; - PyObject *submodule; -- PyObject *sys_modules = PyThreadState_GET()->interp->modules; -+ PyObject *sys_modules = PyImport_GetModuleDict(); - const char *mod_full; - - mod = PyModule_Create(&BGE_module_def); --- -2.25.0 - -- cgit v1.2.3