0006_python3_7.patch 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. commit 00f84e4cb1efc02149d9c04df79048c04351e46a
  2. Author: CYBERDEViL <cyberdevil@notabug.org>
  3. Date: Sun Dec 17 01:13:47 2023 +0100
  4. python3.7: "Cleanup: remove deprecated PyEval_InitThreads use"
  5. Fully applied Blender upstream ref: d377b1fe762c24ee74805ea8c1f666f121399698
  6. commit a6323887a2db1acd10bd0fd1539fb8c061efc7f3
  7. Author: CYBERDEViL <cyberdevil@notabug.org>
  8. Date: Sat Dec 16 17:51:18 2023 +0100
  9. python3.7: "Fix PyRNA class registration w/ Python 3.7"
  10. Fully applied Blender upstream ref: 1db47a2ccd1e68994bf8140eba6cc2a26a2bc91f
  11. diff --git a/blender-2.79b/source/blender/python/intern/bpy_interface.c b/blender-2.79b/source/blender/python/intern/bpy_interface.c
  12. index 20cfd36..6077418 100644
  13. --- a/blender-2.79b/source/blender/python/intern/bpy_interface.c
  14. +++ b/blender-2.79b/source/blender/python/intern/bpy_interface.c
  15. @@ -268,6 +268,7 @@ void BPY_python_start(int argc, const char **argv)
  16. Py_FrozenFlag = 1;
  17. + /* Initialize Python (also acquires lock). */
  18. Py_Initialize();
  19. // PySys_SetArgv(argc, argv); /* broken in py3, not a huge deal */
  20. @@ -284,9 +285,7 @@ void BPY_python_start(int argc, const char **argv)
  21. PySys_SetObject("argv", py_argv);
  22. Py_DECREF(py_argv);
  23. }
  24. -
  25. - /* Initialize thread support (also acquires lock) */
  26. - PyEval_InitThreads();
  27. +
  28. #else
  29. (void)argc;
  30. (void)argv;
  31. diff --git a/blender-2.79b/source/blender/python/intern/bpy_rna.c b/blender-2.79b/source/blender/python/intern/bpy_rna.c
  32. index 0d3781c..832a872 100644
  33. --- a/blender-2.79b/source/blender/python/intern/bpy_rna.c
  34. +++ b/blender-2.79b/source/blender/python/intern/bpy_rna.c
  35. @@ -7385,10 +7385,12 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr, StructRNA *srna, v
  36. if (!(flag & PROP_REGISTER))
  37. continue;
  38. + /* TODO(campbell): Use Python3.7x _PyObject_LookupAttr(), also in the macro below. */
  39. identifier = RNA_property_identifier(prop);
  40. item = PyObject_GetAttrString(py_class, identifier);
  41. if (item == NULL) {
  42. + PyErr_Clear();
  43. /* Sneaky workaround to use the class name as the bl_idname */
  44. #define BPY_REPLACEMENT_STRING(rna_attr, py_attr) \
  45. @@ -7404,6 +7406,9 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr, StructRNA *srna, v
  46. } \
  47. Py_DECREF(item); \
  48. } \
  49. + else { \
  50. + PyErr_Clear(); \
  51. + } \
  52. } /* intentionally allow else here */
  53. if (false) {} /* needed for macro */