You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
923 B

  1. --- exec.cpp.orig 2019-12-10 01:19:39.000000000 +0100
  2. +++ exec.cpp 2021-11-25 11:11:49.933084600 +0100
  3. @@ -104,9 +104,16 @@
  4. if (local.is_none()) local = global;
  5. // should be 'char const *' but older python versions don't use 'const' yet.
  6. char *f = const_cast<char *>(filename);
  7. - // Let python open the file to avoid potential binary incompatibilities.
  8. -#if PY_VERSION_HEX >= 0x03040000
  9. - FILE *fs = _Py_fopen(f, "r");
  10. +#if PY_VERSION_HEX >= 0x03010000
  11. + // Backported from Boost.Python v1.75.0 to build LuxCore for Python 3.10
  12. + // Let python manage any UTF bits to avoid potential incompatibilities.
  13. + PyObject *fo = Py_BuildValue("s", f);
  14. + PyObject *fb = Py_None;
  15. + PyUnicode_FSConverter(fo, &fb);
  16. + f = PyBytes_AsString(fb);
  17. + FILE *fs = fopen(f, "r");
  18. + Py_DECREF(fo);
  19. + Py_DECREF(fb);
  20. #elif PY_VERSION_HEX >= 0x03000000
  21. PyObject *fo = Py_BuildValue("s", f);
  22. FILE *fs = _Py_fopen(fo, "r");