0007_python3_8.patch 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. commit fce4c8799bcddb8a159d4c3cd1480cf174d02ee4
  2. Author: CYBERDEViL <cyberdevil@notabug.org>
  3. Date: Sat Dec 16 02:43:28 2023 +0100
  4. python3.8: "Cleanup: define PY_SSIZE_T_CLEAN for Python"
  5. Fully applied Blender upstream ref: 9dd5e3b6e89ca0be4207e64439f292519eaf7e6e
  6. commit 89c9462c0a921b6af37043ee2ab147c60cd0f422
  7. Author: CYBERDEViL <cyberdevil@notabug.org>
  8. Date: Sat Dec 16 01:49:26 2023 +0100
  9. python3.8: "PyAPI: use public API's for module & builtin access"
  10. Partially applied Blender upstream ref: e413b39a936181cc954dfbf054b0a19794d8902c
  11. commit 2b0312742399a9143f33a78a4f5ceedd08d178d6
  12. Author: CYBERDEViL <cyberdevil@notabug.org>
  13. Date: Sat Dec 16 00:53:34 2023 +0100
  14. python3.8: "Cleanup: warnings building with Python 3.8"
  15. Adjusted Blender upstream ref: 36b6fb5cd600a7067d24cfe836c0af4d94e083e4
  16. commit 2093b30818fcddf1f0d2d0011bae023d9124b351
  17. Author: CYBERDEViL <cyberdevil@notabug.org>
  18. Date: Sat Dec 16 00:23:26 2023 +0100
  19. python3.8: "Cleanup: use PyImport_GetModuleDict"
  20. Adjusted Blender upstream ref: 44f719b63238503ef8f933f55383c6d4798995cc
  21. diff --git a/blender-2.79b/source/blender/python/bmesh/bmesh_py_api.c b/blender-2.79b/source/blender/python/bmesh/bmesh_py_api.c
  22. index d5973ba..d7324ea 100644
  23. --- a/blender-2.79b/source/blender/python/bmesh/bmesh_py_api.c
  24. +++ b/blender-2.79b/source/blender/python/bmesh/bmesh_py_api.c
  25. @@ -196,7 +196,7 @@ PyObject *BPyInit_bmesh(void)
  26. {
  27. PyObject *mod;
  28. PyObject *submodule;
  29. - PyObject *sys_modules = PyThreadState_GET()->interp->modules;
  30. + PyObject *sys_modules = PyImport_GetModuleDict();
  31. BPy_BM_init_types();
  32. BPy_BM_init_types_select();
  33. diff --git a/blender-2.79b/source/blender/python/bmesh/bmesh_py_ops.c b/blender-2.79b/source/blender/python/bmesh/bmesh_py_ops.c
  34. index ee96c85..ea37159 100644
  35. --- a/blender-2.79b/source/blender/python/bmesh/bmesh_py_ops.c
  36. +++ b/blender-2.79b/source/blender/python/bmesh/bmesh_py_ops.c
  37. @@ -142,7 +142,7 @@ static PyTypeObject bmesh_op_Type = {
  38. 0, /* tp_itemsize */
  39. /* methods */
  40. NULL, /* tp_dealloc */
  41. - NULL, /* printfunc tp_print; */
  42. + (printfunc)NULL, /* printfunc tp_print; */
  43. NULL, /* getattrfunc tp_getattr; */
  44. NULL, /* setattrfunc tp_setattr; */
  45. NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
  46. @@ -260,7 +260,7 @@ static PyTypeObject bmesh_ops_fakemod_Type = {
  47. 0, /* tp_itemsize */
  48. /* methods */
  49. NULL, /* tp_dealloc */
  50. - NULL, /* printfunc tp_print; */
  51. + (printfunc)NULL, /* printfunc tp_print; */
  52. NULL, /* getattrfunc tp_getattr; */
  53. NULL, /* setattrfunc tp_setattr; */
  54. NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
  55. diff --git a/blender-2.79b/source/blender/python/generic/blf_py_api.c b/blender-2.79b/source/blender/python/generic/blf_py_api.c
  56. index 69f1e29..bf8259f 100644
  57. --- a/blender-2.79b/source/blender/python/generic/blf_py_api.c
  58. +++ b/blender-2.79b/source/blender/python/generic/blf_py_api.c
  59. @@ -26,6 +26,9 @@
  60. * This file defines the 'bgl' module, used for drawing text in OpenGL.
  61. */
  62. +/* Future-proof, See https://docs.python.org/3/c-api/arg.html#strings-and-buffers */
  63. +#define PY_SSIZE_T_CLEAN
  64. +
  65. #include <Python.h>
  66. #include "blf_py_api.h"
  67. @@ -150,7 +153,7 @@ PyDoc_STRVAR(py_blf_draw_doc,
  68. static PyObject *py_blf_draw(PyObject *UNUSED(self), PyObject *args)
  69. {
  70. const char *text;
  71. - int text_length;
  72. + Py_ssize_t text_length;
  73. int fontid;
  74. if (!PyArg_ParseTuple(args, "is#:blf.draw", &fontid, &text, &text_length))
  75. diff --git a/blender-2.79b/source/blender/python/generic/idprop_py_api.c b/blender-2.79b/source/blender/python/generic/idprop_py_api.c
  76. index 5d6a7c5..576f114 100644
  77. --- a/blender-2.79b/source/blender/python/generic/idprop_py_api.c
  78. +++ b/blender-2.79b/source/blender/python/generic/idprop_py_api.c
  79. @@ -1166,7 +1166,7 @@ PyTypeObject BPy_IDGroup_Type = {
  80. /* Methods to implement standard operations */
  81. NULL, /* destructor tp_dealloc; */
  82. - NULL, /* printfunc tp_print; */
  83. + (printfunc)NULL, /* printfunc tp_print; */
  84. NULL, /* getattrfunc tp_getattr; */
  85. NULL, /* setattrfunc tp_setattr; */
  86. NULL, /* cmpfunc tp_compare; */
  87. @@ -1560,7 +1560,7 @@ PyTypeObject BPy_IDArray_Type = {
  88. /* Methods to implement standard operations */
  89. NULL, /* destructor tp_dealloc; */
  90. - NULL, /* printfunc tp_print; */
  91. + (printfunc)NULL, /* printfunc tp_print; */
  92. NULL, /* getattrfunc tp_getattr; */
  93. NULL, /* setattrfunc tp_setattr; */
  94. NULL, /* cmpfunc tp_compare; */
  95. @@ -1675,7 +1675,7 @@ PyTypeObject BPy_IDGroup_Iter_Type = {
  96. /* Methods to implement standard operations */
  97. NULL, /* destructor tp_dealloc; */
  98. - NULL, /* printfunc tp_print; */
  99. + (printfunc)NULL, /* printfunc tp_print; */
  100. NULL, /* getattrfunc tp_getattr; */
  101. NULL, /* setattrfunc tp_setattr; */
  102. NULL, /* cmpfunc tp_compare; */
  103. @@ -1792,7 +1792,7 @@ PyObject *BPyInit_idprop(void)
  104. {
  105. PyObject *mod;
  106. PyObject *submodule;
  107. - PyObject *sys_modules = PyThreadState_GET()->interp->modules;
  108. + PyObject *sys_modules = PyImport_GetModuleDict();
  109. mod = PyModule_Create(&IDProp_module_def);
  110. diff --git a/blender-2.79b/source/blender/python/generic/py_capi_utils.c b/blender-2.79b/source/blender/python/generic/py_capi_utils.c
  111. index 861e2db..f4a2595 100644
  112. --- a/blender-2.79b/source/blender/python/generic/py_capi_utils.c
  113. +++ b/blender-2.79b/source/blender/python/generic/py_capi_utils.c
  114. @@ -29,6 +29,9 @@
  115. * BLI_string_utf8() for unicode conversion.
  116. */
  117. +/* Future-proof, See https://docs.python.org/3/c-api/arg.html#strings-and-buffers */
  118. +#define PY_SSIZE_T_CLEAN
  119. +
  120. #include <Python.h>
  121. #include <frameobject.h>
  122. @@ -638,9 +641,10 @@ PyObject *PyC_UnicodeFromByte(const char *str)
  123. ****************************************************************************/
  124. PyObject *PyC_DefaultNameSpace(const char *filename)
  125. {
  126. - PyInterpreterState *interp = PyThreadState_GET()->interp;
  127. + PyObject *modules = PyImport_GetModuleDict();
  128. + PyObject *builtins = PyEval_GetBuiltins();
  129. PyObject *mod_main = PyModule_New("__main__");
  130. - PyDict_SetItemString(interp->modules, "__main__", mod_main);
  131. + PyDict_SetItemString(modules, "__main__", mod_main);
  132. Py_DECREF(mod_main); /* sys.modules owns now */
  133. PyModule_AddStringConstant(mod_main, "__name__", "__main__");
  134. if (filename) {
  135. @@ -648,23 +652,23 @@ PyObject *PyC_DefaultNameSpace(const char *filename)
  136. * note: this wont map to a real file when executing text-blocks and buttons. */
  137. PyModule_AddObject(mod_main, "__file__", PyC_UnicodeFromByte(filename));
  138. }
  139. - PyModule_AddObject(mod_main, "__builtins__", interp->builtins);
  140. - Py_INCREF(interp->builtins); /* AddObject steals a reference */
  141. + PyModule_AddObject(mod_main, "__builtins__", builtins);
  142. + Py_INCREF(builtins); /* AddObject steals a reference */
  143. return PyModule_GetDict(mod_main);
  144. }
  145. /* restore MUST be called after this */
  146. void PyC_MainModule_Backup(PyObject **main_mod)
  147. {
  148. - PyInterpreterState *interp = PyThreadState_GET()->interp;
  149. - *main_mod = PyDict_GetItemString(interp->modules, "__main__");
  150. + PyObject *modules = PyImport_GetModuleDict();
  151. + *main_mod = PyDict_GetItemString(modules, "__main__");
  152. Py_XINCREF(*main_mod); /* don't free */
  153. }
  154. void PyC_MainModule_Restore(PyObject *main_mod)
  155. {
  156. - PyInterpreterState *interp = PyThreadState_GET()->interp;
  157. - PyDict_SetItemString(interp->modules, "__main__", main_mod);
  158. + PyObject *modules = PyImport_GetModuleDict();
  159. + PyDict_SetItemString(modules, "__main__", main_mod);
  160. Py_XDECREF(main_mod);
  161. }
  162. @@ -732,7 +736,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
  163. va_list vargs;
  164. - int *sizes = PyMem_MALLOC(sizeof(int) * (n / 2));
  165. + Py_ssize_t *sizes = PyMem_MALLOC(sizeof(*sizes) * (n / 2));
  166. int i;
  167. PyObject *py_dict = PyC_DefaultNameSpace(filepath);
  168. diff --git a/blender-2.79b/source/blender/python/intern/bpy_app_translations.c b/blender-2.79b/source/blender/python/intern/bpy_app_translations.c
  169. index 6ba858f..1b853be 100644
  170. --- a/blender-2.79b/source/blender/python/intern/bpy_app_translations.c
  171. +++ b/blender-2.79b/source/blender/python/intern/bpy_app_translations.c
  172. @@ -714,7 +714,7 @@ static PyTypeObject BlenderAppTranslationsType = {
  173. /* methods */
  174. /* No destructor, this is a singleton! */
  175. NULL, /* tp_dealloc */
  176. - NULL, /* printfunc tp_print; */
  177. + (printfunc)NULL, /* printfunc tp_print; */
  178. NULL, /* getattrfunc tp_getattr; */
  179. NULL, /* setattrfunc tp_setattr; */
  180. NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
  181. diff --git a/blender-2.79b/source/blender/python/intern/bpy_interface.c b/blender-2.79b/source/blender/python/intern/bpy_interface.c
  182. index 6077418..0d36ba1 100644
  183. --- a/blender-2.79b/source/blender/python/intern/bpy_interface.c
  184. +++ b/blender-2.79b/source/blender/python/intern/bpy_interface.c
  185. @@ -529,7 +529,7 @@ static bool python_script_exec(
  186. if (py_dict) {
  187. #ifdef PYMODULE_CLEAR_WORKAROUND
  188. - PyModuleObject *mmod = (PyModuleObject *)PyDict_GetItemString(PyThreadState_GET()->interp->modules, "__main__");
  189. + PyModuleObject *mmod = (PyModuleObject *)PyDict_GetItemString(PyImport_GetModuleDict(), "__main__");
  190. PyObject *dict_back = mmod->md_dict;
  191. /* freeing the module will clear the namespace,
  192. * gives problems running classes defined in this namespace being used later. */
  193. diff --git a/blender-2.79b/source/blender/python/intern/bpy_library_load.c b/blender-2.79b/source/blender/python/intern/bpy_library_load.c
  194. index cb6a714..c8fd392 100644
  195. --- a/blender-2.79b/source/blender/python/intern/bpy_library_load.c
  196. +++ b/blender-2.79b/source/blender/python/intern/bpy_library_load.c
  197. @@ -98,7 +98,7 @@ static PyTypeObject bpy_lib_Type = {
  198. 0, /* tp_itemsize */
  199. /* methods */
  200. (destructor)bpy_lib_dealloc, /* tp_dealloc */
  201. - NULL, /* printfunc tp_print; */
  202. + (printfunc)NULL, /* printfunc tp_print; */
  203. NULL, /* getattrfunc tp_getattr; */
  204. NULL, /* setattrfunc tp_setattr; */
  205. NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
  206. diff --git a/blender-2.79b/source/blender/python/intern/bpy_props.c b/blender-2.79b/source/blender/python/intern/bpy_props.c
  207. index 3a18167..2b8e356 100644
  208. --- a/blender-2.79b/source/blender/python/intern/bpy_props.c
  209. +++ b/blender-2.79b/source/blender/python/intern/bpy_props.c
  210. @@ -28,6 +28,8 @@
  211. * existing blender types.
  212. */
  213. +/* Future-proof, See https://docs.python.org/3/c-api/arg.html#strings-and-buffers */
  214. +#define PY_SSIZE_T_CLEAN
  215. #include <Python.h>
  216. @@ -2012,7 +2014,7 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
  217. static const char *kwlist[] = {"attr", "name", "description", "default",
  218. "options", "subtype", "update", "get", "set", NULL};
  219. const char *id = NULL, *name = NULL, *description = "";
  220. - int id_len;
  221. + Py_ssize_t id_len;
  222. bool def = false;
  223. PropertyRNA *prop;
  224. PyObject *pyopts = NULL;
  225. @@ -2094,7 +2096,7 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject
  226. static const char *kwlist[] = {"attr", "name", "description", "default",
  227. "options", "subtype", "size", "update", "get", "set", NULL};
  228. const char *id = NULL, *name = NULL, *description = "";
  229. - int id_len;
  230. + Py_ssize_t id_len;
  231. int def[PYRNA_STACK_ARRAY] = {0};
  232. int size = 3;
  233. PropertyRNA *prop;
  234. @@ -2199,7 +2201,7 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
  235. "min", "max", "soft_min", "soft_max",
  236. "step", "options", "subtype", "update", "get", "set", NULL};
  237. const char *id = NULL, *name = NULL, *description = "";
  238. - int id_len;
  239. + Py_ssize_t id_len;
  240. int min = INT_MIN, max = INT_MAX, soft_min = INT_MIN, soft_max = INT_MAX, step = 1, def = 0;
  241. PropertyRNA *prop;
  242. PyObject *pyopts = NULL;
  243. @@ -2296,7 +2298,7 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject
  244. "min", "max", "soft_min", "soft_max",
  245. "step", "options", "subtype", "size", "update", "get", "set", NULL};
  246. const char *id = NULL, *name = NULL, *description = "";
  247. - int id_len;
  248. + Py_ssize_t id_len;
  249. int min = INT_MIN, max = INT_MAX, soft_min = INT_MIN, soft_max = INT_MAX, step = 1;
  250. int def[PYRNA_STACK_ARRAY] = {0};
  251. int size = 3;
  252. @@ -2410,7 +2412,7 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
  253. "step", "precision", "options", "subtype",
  254. "unit", "update", "get", "set", NULL};
  255. const char *id = NULL, *name = NULL, *description = "";
  256. - int id_len;
  257. + Py_ssize_t id_len;
  258. float min = -FLT_MAX, max = FLT_MAX, soft_min = -FLT_MAX, soft_max = FLT_MAX, step = 3, def = 0.0f;
  259. int precision = 2;
  260. PropertyRNA *prop;
  261. @@ -2521,7 +2523,7 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec
  262. "step", "precision", "options", "subtype",
  263. "unit", "size", "update", "get", "set", NULL};
  264. const char *id = NULL, *name = NULL, *description = "";
  265. - int id_len;
  266. + Py_ssize_t id_len;
  267. float min = -FLT_MAX, max = FLT_MAX, soft_min = -FLT_MAX, soft_max = FLT_MAX, step = 3;
  268. float def[PYRNA_STACK_ARRAY] = {0.0f};
  269. int precision = 2, size = 3;
  270. @@ -2628,7 +2630,7 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw
  271. static const char *kwlist[] = {"attr", "name", "description", "default",
  272. "maxlen", "options", "subtype", "update", "get", "set", NULL};
  273. const char *id = NULL, *name = NULL, *description = "", *def = "";
  274. - int id_len;
  275. + Py_ssize_t id_len;
  276. int maxlen = 0;
  277. PropertyRNA *prop;
  278. PyObject *pyopts = NULL;
  279. @@ -2738,7 +2740,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
  280. "options", "update", "get", "set", NULL};
  281. const char *id = NULL, *name = NULL, *description = "";
  282. PyObject *def = NULL;
  283. - int id_len;
  284. + Py_ssize_t id_len;
  285. int defvalue = 0;
  286. PyObject *items, *items_fast;
  287. EnumPropertyItem *eitems;
  288. @@ -2886,7 +2888,7 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw)
  289. if (srna) {
  290. static const char *kwlist[] = {"attr", "type", "name", "description", "options", "poll", "update", NULL};
  291. const char *id = NULL, *name = NULL, *description = "";
  292. - int id_len;
  293. + Py_ssize_t id_len;
  294. PropertyRNA *prop;
  295. StructRNA *ptype;
  296. PyObject *type = Py_None;
  297. @@ -2960,7 +2962,7 @@ PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw)
  298. if (srna) {
  299. static const char *kwlist[] = {"attr", "type", "name", "description", "options", NULL};
  300. const char *id = NULL, *name = NULL, *description = "";
  301. - int id_len;
  302. + Py_ssize_t id_len;
  303. PropertyRNA *prop;
  304. StructRNA *ptype;
  305. PyObject *type = Py_None;
  306. diff --git a/blender-2.79b/source/blender/python/intern/bpy_rna.c b/blender-2.79b/source/blender/python/intern/bpy_rna.c
  307. index 832a872..b473398 100644
  308. --- a/blender-2.79b/source/blender/python/intern/bpy_rna.c
  309. +++ b/blender-2.79b/source/blender/python/intern/bpy_rna.c
  310. @@ -5647,7 +5647,7 @@ PyTypeObject pyrna_struct_meta_idprop_Type = {
  311. 0, /* tp_itemsize */
  312. /* methods */
  313. NULL, /* tp_dealloc */
  314. - NULL, /* printfunc tp_print; */
  315. + (printfunc)NULL, /* printfunc tp_print; */
  316. NULL, /* getattrfunc tp_getattr; */
  317. NULL, /* setattrfunc tp_setattr; */
  318. NULL, /* tp_compare */ /* deprecated in python 3.0! */
  319. @@ -5729,7 +5729,7 @@ PyTypeObject pyrna_struct_Type = {
  320. 0, /* tp_itemsize */
  321. /* methods */
  322. (destructor) pyrna_struct_dealloc, /* tp_dealloc */
  323. - NULL, /* printfunc tp_print; */
  324. + (printfunc)NULL, /* printfunc tp_print; */
  325. NULL, /* getattrfunc tp_getattr; */
  326. NULL, /* setattrfunc tp_setattr; */
  327. NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
  328. @@ -5818,7 +5818,7 @@ PyTypeObject pyrna_prop_Type = {
  329. 0, /* tp_itemsize */
  330. /* methods */
  331. (destructor) pyrna_prop_dealloc, /* tp_dealloc */
  332. - NULL, /* printfunc tp_print; */
  333. + (printfunc)NULL, /* printfunc tp_print; */
  334. NULL, /* getattrfunc tp_getattr; */
  335. NULL, /* setattrfunc tp_setattr; */
  336. NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
  337. @@ -5902,7 +5902,7 @@ PyTypeObject pyrna_prop_array_Type = {
  338. 0, /* tp_itemsize */
  339. /* methods */
  340. (destructor)pyrna_prop_array_dealloc, /* tp_dealloc */
  341. - NULL, /* printfunc tp_print; */
  342. + (printfunc)NULL, /* printfunc tp_print; */
  343. NULL, /* getattrfunc tp_getattr; */
  344. NULL, /* setattrfunc tp_setattr; */
  345. NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
  346. @@ -5985,7 +5985,7 @@ PyTypeObject pyrna_prop_collection_Type = {
  347. 0, /* tp_itemsize */
  348. /* methods */
  349. (destructor)pyrna_prop_dealloc, /* tp_dealloc */
  350. - NULL, /* printfunc tp_print; */
  351. + (printfunc)NULL, /* printfunc tp_print; */
  352. NULL, /* getattrfunc tp_getattr; */
  353. NULL, /* setattrfunc tp_setattr; */
  354. NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
  355. @@ -6070,7 +6070,7 @@ static PyTypeObject pyrna_prop_collection_idprop_Type = {
  356. 0, /* tp_itemsize */
  357. /* methods */
  358. (destructor)pyrna_prop_dealloc, /* tp_dealloc */
  359. - NULL, /* printfunc tp_print; */
  360. + (printfunc)NULL, /* printfunc tp_print; */
  361. NULL, /* getattrfunc tp_getattr; */
  362. NULL, /* setattrfunc tp_setattr; */
  363. NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
  364. @@ -6155,7 +6155,7 @@ PyTypeObject pyrna_func_Type = {
  365. 0, /* tp_itemsize */
  366. /* methods */
  367. NULL, /* tp_dealloc */
  368. - NULL, /* printfunc tp_print; */
  369. + (printfunc)NULL, /* printfunc tp_print; */
  370. NULL, /* getattrfunc tp_getattr; */
  371. NULL, /* setattrfunc tp_setattr; */
  372. NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
  373. @@ -6251,7 +6251,7 @@ static PyTypeObject pyrna_prop_collection_iter_Type = {
  374. 0, /* tp_itemsize */
  375. /* methods */
  376. (destructor)pyrna_prop_collection_iter_dealloc, /* tp_dealloc */
  377. - NULL, /* printfunc tp_print; */
  378. + (printfunc)NULL, /* printfunc tp_print; */
  379. NULL, /* getattrfunc tp_getattr; */
  380. NULL, /* setattrfunc tp_setattr; */
  381. NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
  382. diff --git a/blender-2.79b/source/blender/python/intern/gpu.c b/blender-2.79b/source/blender/python/intern/gpu.c
  383. index 48230a7..25016c5 100644
  384. --- a/blender-2.79b/source/blender/python/intern/gpu.c
  385. +++ b/blender-2.79b/source/blender/python/intern/gpu.c
  386. @@ -323,7 +323,7 @@ PyObject *GPU_initPython(void)
  387. {
  388. PyObject *module;
  389. PyObject *submodule;
  390. - PyObject *sys_modules = PyThreadState_GET()->interp->modules;
  391. + PyObject *sys_modules = PyImport_GetModuleDict();
  392. module = PyInit_gpu();
  393. @@ -334,7 +334,7 @@ PyObject *GPU_initPython(void)
  394. PyDict_SetItem(sys_modules, PyModule_GetNameObject(submodule), submodule);
  395. Py_INCREF(submodule);
  396. - PyDict_SetItem(PyImport_GetModuleDict(), PyModule_GetNameObject(module), module);
  397. + PyDict_SetItem(sys_modules, PyModule_GetNameObject(module), module);
  398. return module;
  399. }
  400. diff --git a/blender-2.79b/source/blender/python/intern/gpu_offscreen.c b/blender-2.79b/source/blender/python/intern/gpu_offscreen.c
  401. index 7711ce1..d301599 100644
  402. --- a/blender-2.79b/source/blender/python/intern/gpu_offscreen.c
  403. +++ b/blender-2.79b/source/blender/python/intern/gpu_offscreen.c
  404. @@ -293,7 +293,7 @@ static PyTypeObject BPy_GPUOffScreen_Type = {
  405. 0, /* tp_itemsize */
  406. /* methods */
  407. (destructor)BPy_GPUOffScreen__tp_dealloc, /* tp_dealloc */
  408. - NULL, /* tp_print */
  409. + (printfunc)NULL, /* tp_print */
  410. NULL, /* tp_getattr */
  411. NULL, /* tp_setattr */
  412. NULL, /* tp_compare */
  413. diff --git a/blender-2.79b/source/blender/python/mathutils/mathutils.c b/blender-2.79b/source/blender/python/mathutils/mathutils.c
  414. index 96ae0a9..21d3624 100644
  415. --- a/blender-2.79b/source/blender/python/mathutils/mathutils.c
  416. +++ b/blender-2.79b/source/blender/python/mathutils/mathutils.c
  417. @@ -622,7 +622,7 @@ PyMODINIT_FUNC PyInit_mathutils(void)
  418. {
  419. PyObject *mod;
  420. PyObject *submodule;
  421. - PyObject *sys_modules = PyThreadState_GET()->interp->modules;
  422. + PyObject *sys_modules = PyImport_GetModuleDict();
  423. if (PyType_Ready(&vector_Type) < 0)
  424. return NULL;
  425. diff --git a/blender-2.79b/source/blender/python/mathutils/mathutils_Color.c b/blender-2.79b/source/blender/python/mathutils/mathutils_Color.c
  426. index 9997cd9..b12982e 100644
  427. --- a/blender-2.79b/source/blender/python/mathutils/mathutils_Color.c
  428. +++ b/blender-2.79b/source/blender/python/mathutils/mathutils_Color.c
  429. @@ -846,7 +846,7 @@ PyTypeObject color_Type = {
  430. sizeof(ColorObject), /* tp_basicsize */
  431. 0, /* tp_itemsize */
  432. (destructor)BaseMathObject_dealloc, /* tp_dealloc */
  433. - NULL, /* tp_print */
  434. + (printfunc)NULL, /* tp_print */
  435. NULL, /* tp_getattr */
  436. NULL, /* tp_setattr */
  437. NULL, /* tp_compare */
  438. diff --git a/blender-2.79b/source/blender/python/mathutils/mathutils_Euler.c b/blender-2.79b/source/blender/python/mathutils/mathutils_Euler.c
  439. index 9492b6d..494b5ea 100644
  440. --- a/blender-2.79b/source/blender/python/mathutils/mathutils_Euler.c
  441. +++ b/blender-2.79b/source/blender/python/mathutils/mathutils_Euler.c
  442. @@ -700,7 +700,7 @@ PyTypeObject euler_Type = {
  443. sizeof(EulerObject), /* tp_basicsize */
  444. 0, /* tp_itemsize */
  445. (destructor)BaseMathObject_dealloc, /* tp_dealloc */
  446. - NULL, /* tp_print */
  447. + (printfunc)NULL, /* tp_print */
  448. NULL, /* tp_getattr */
  449. NULL, /* tp_setattr */
  450. NULL, /* tp_compare */
  451. diff --git a/blender-2.79b/source/blender/python/mathutils/mathutils_Matrix.c b/blender-2.79b/source/blender/python/mathutils/mathutils_Matrix.c
  452. index e368e88..1b05aae 100644
  453. --- a/blender-2.79b/source/blender/python/mathutils/mathutils_Matrix.c
  454. +++ b/blender-2.79b/source/blender/python/mathutils/mathutils_Matrix.c
  455. @@ -2768,7 +2768,7 @@ PyTypeObject matrix_Type = {
  456. sizeof(MatrixObject), /*tp_basicsize*/
  457. 0, /*tp_itemsize*/
  458. (destructor)BaseMathObject_dealloc, /*tp_dealloc*/
  459. - NULL, /*tp_print*/
  460. + (printfunc)NULL, /*tp_print*/
  461. NULL, /*tp_getattr*/
  462. NULL, /*tp_setattr*/
  463. NULL, /*tp_compare*/
  464. @@ -3092,7 +3092,7 @@ PyTypeObject matrix_access_Type = {
  465. sizeof(MatrixAccessObject), /*tp_basicsize*/
  466. 0, /*tp_itemsize*/
  467. (destructor)MatrixAccess_dealloc, /*tp_dealloc*/
  468. - NULL, /*tp_print*/
  469. + (printfunc)NULL, /*tp_print*/
  470. NULL, /*tp_getattr*/
  471. NULL, /*tp_setattr*/
  472. NULL, /*tp_compare*/
  473. diff --git a/blender-2.79b/source/blender/python/mathutils/mathutils_Quaternion.c b/blender-2.79b/source/blender/python/mathutils/mathutils_Quaternion.c
  474. index d283c71..02aabd0 100644
  475. --- a/blender-2.79b/source/blender/python/mathutils/mathutils_Quaternion.c
  476. +++ b/blender-2.79b/source/blender/python/mathutils/mathutils_Quaternion.c
  477. @@ -1275,7 +1275,7 @@ PyTypeObject quaternion_Type = {
  478. sizeof(QuaternionObject), /* tp_basicsize */
  479. 0, /* tp_itemsize */
  480. (destructor)BaseMathObject_dealloc, /* tp_dealloc */
  481. - NULL, /* tp_print */
  482. + (printfunc)NULL, /* tp_print */
  483. NULL, /* tp_getattr */
  484. NULL, /* tp_setattr */
  485. NULL, /* tp_compare */
  486. diff --git a/blender-2.79b/source/blender/python/mathutils/mathutils_Vector.c b/blender-2.79b/source/blender/python/mathutils/mathutils_Vector.c
  487. index afc8a30..af73aa2 100644
  488. --- a/blender-2.79b/source/blender/python/mathutils/mathutils_Vector.c
  489. +++ b/blender-2.79b/source/blender/python/mathutils/mathutils_Vector.c
  490. @@ -2887,7 +2887,7 @@ PyTypeObject vector_Type = {
  491. /* Methods to implement standard operations */
  492. (destructor) BaseMathObject_dealloc, /* destructor tp_dealloc; */
  493. - NULL, /* printfunc tp_print; */
  494. + (printfunc)NULL, /* printfunc tp_print; */
  495. NULL, /* getattrfunc tp_getattr; */
  496. NULL, /* setattrfunc tp_setattr; */
  497. NULL, /* cmpfunc tp_compare; */
  498. diff --git a/blender-2.79b/source/blender/python/mathutils/mathutils_bvhtree.c b/blender-2.79b/source/blender/python/mathutils/mathutils_bvhtree.c
  499. index 30c0cda..c3b28e7 100644
  500. --- a/blender-2.79b/source/blender/python/mathutils/mathutils_bvhtree.c
  501. +++ b/blender-2.79b/source/blender/python/mathutils/mathutils_bvhtree.c
  502. @@ -1243,7 +1243,7 @@ PyTypeObject PyBVHTree_Type = {
  503. 0, /* tp_itemsize */
  504. /* methods */
  505. (destructor)py_bvhtree__tp_dealloc, /* tp_dealloc */
  506. - NULL, /* tp_print */
  507. + (printfunc)NULL, /* tp_print */
  508. NULL, /* tp_getattr */
  509. NULL, /* tp_setattr */
  510. NULL, /* tp_compare */
  511. diff --git a/blender-2.79b/source/blender/python/mathutils/mathutils_kdtree.c b/blender-2.79b/source/blender/python/mathutils/mathutils_kdtree.c
  512. index ca66c19..2e36a08 100644
  513. --- a/blender-2.79b/source/blender/python/mathutils/mathutils_kdtree.c
  514. +++ b/blender-2.79b/source/blender/python/mathutils/mathutils_kdtree.c
  515. @@ -415,7 +415,7 @@ PyTypeObject PyKDTree_Type = {
  516. 0, /* tp_itemsize */
  517. /* methods */
  518. (destructor)PyKDTree__tp_dealloc, /* tp_dealloc */
  519. - NULL, /* tp_print */
  520. + (printfunc)NULL, /* tp_print */
  521. NULL, /* tp_getattr */
  522. NULL, /* tp_setattr */
  523. NULL, /* tp_compare */
  524. diff --git a/blender-2.79b/source/blender/python/mathutils/mathutils_noise.c b/blender-2.79b/source/blender/python/mathutils/mathutils_noise.c
  525. index 143e51e..f9d128f 100644
  526. --- a/blender-2.79b/source/blender/python/mathutils/mathutils_noise.c
  527. +++ b/blender-2.79b/source/blender/python/mathutils/mathutils_noise.c
  528. @@ -842,16 +842,17 @@ PyMODINIT_FUNC PyInit_mathutils_noise(void)
  529. {
  530. PyObject *submodule = PyModule_Create(&M_Noise_module_def);
  531. PyObject *item_types, *item_metrics;
  532. + PyObject *sys_modules = PyImport_GetModuleDict();
  533. /* use current time as seed for random number generator by default */
  534. setRndSeed(0);
  535. PyModule_AddObject(submodule, "types", (item_types = PyInit_mathutils_noise_types()));
  536. - PyDict_SetItemString(PyThreadState_GET()->interp->modules, "noise.types", item_types);
  537. + PyDict_SetItemString(sys_modules, "noise.types", item_types);
  538. Py_INCREF(item_types);
  539. PyModule_AddObject(submodule, "distance_metrics", (item_metrics = PyInit_mathutils_noise_metrics()));
  540. - PyDict_SetItemString(PyThreadState_GET()->interp->modules, "noise.distance_metrics", item_metrics);
  541. + PyDict_SetItemString(sys_modules, "noise.distance_metrics", item_metrics);
  542. Py_INCREF(item_metrics);
  543. return submodule;
  544. diff --git a/blender-2.79b/source/gameengine/Ketsji/KX_PythonInit.cpp b/blender-2.79b/source/gameengine/Ketsji/KX_PythonInit.cpp
  545. index 97a7e16..71e610d 100644
  546. --- a/blender-2.79b/source/gameengine/Ketsji/KX_PythonInit.cpp
  547. +++ b/blender-2.79b/source/gameengine/Ketsji/KX_PythonInit.cpp
  548. @@ -1569,7 +1569,7 @@ PyTypeObject PyRASOffScreen_Type = {
  549. 0, /* tp_itemsize */
  550. /* methods */
  551. (destructor)PyRASOffScreen__tp_dealloc, /* tp_dealloc */
  552. - NULL, /* tp_print */
  553. + (printfunc)NULL, /* tp_print */
  554. NULL, /* tp_getattr */
  555. NULL, /* tp_setattr */
  556. NULL, /* tp_compare */
  557. @@ -2239,7 +2239,7 @@ PyMODINIT_FUNC initBGE(void)
  558. {
  559. PyObject *mod;
  560. PyObject *submodule;
  561. - PyObject *sys_modules = PyThreadState_GET()->interp->modules;
  562. + PyObject *sys_modules = PyImport_GetModuleDict();
  563. const char *mod_full;
  564. mod = PyModule_Create(&BGE_module_def);