Patch Boost.Python for Python 3.10 - replace _Py_fopen() with fopen() (#1912903)

This commit is contained in:
Tomas Hrnciar 2021-01-08 14:10:23 +01:00
parent 64d97f19ff
commit ddd384021b
2 changed files with 37 additions and 1 deletions

View File

@ -0,0 +1,29 @@
From ba90b0adffb5fedc894889b0962c22fff5bb748d Mon Sep 17 00:00:00 2001
From: Tomas Hrnciar <thrnciar@redhat.com>
Date: Thu, 7 Jan 2021 11:46:29 +0100
Subject: [PATCH] fix Boost with Python 3.10
---
src/exec.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/exec.cpp b/src/exec.cpp
index 171c6f41..caa7d086 100644
--- a/libs/python/src/exec.cpp
+++ b/libs/python/src/exec.cpp
@@ -106,10 +106,10 @@ object BOOST_PYTHON_DECL exec_file(char const *filename, object global, object l
char *f = const_cast<char *>(filename);
// Let python open the file to avoid potential binary incompatibilities.
#if PY_VERSION_HEX >= 0x03040000
- FILE *fs = _Py_fopen(f, "r");
+ FILE *fs = fopen(f, "r");
#elif PY_VERSION_HEX >= 0x03000000
PyObject *fo = Py_BuildValue("s", f);
- FILE *fs = _Py_fopen(fo, "r");
+ FILE *fs = fopen(fo, "r");
Py_DECREF(fo);
#else
PyObject *pyfile = PyFile_FromString(f, const_cast<char*>("r"));
--
2.29.2

View File

@ -42,7 +42,7 @@ Name: boost
%global real_name boost
Summary: The free peer-reviewed portable C++ source libraries
Version: 1.73.0
Release: 11%{?dist}
Release: 12%{?dist}
License: Boost and MIT and Python
# Replace each . with _ in %%{version}
@ -175,6 +175,9 @@ Patch93: boost-1.73-python3.10.patch
# https://github.com/boostorg/locale/issues/52
Patch94: boost-1.73-locale-empty-vector.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1912903
Patch95: boost-1.73-python3.10-Py_fopen.patch
%bcond_with tests
%bcond_with docs_generated
@ -693,6 +696,7 @@ find ./boost -name '*.hpp' -perm /111 | xargs chmod a-x
%patch92 -p1
%patch93 -p1
%patch94 -p1
%patch95 -p1
%build
%set_build_flags
@ -1304,6 +1308,9 @@ fi
%{_mandir}/man1/b2.1*
%changelog
* Fri Jan 8 14:14:00 CET 2021 Tomas Hrnciar <thrnciar@redhat.com> - 1.73.0-12
- Patch Boost.Python for Python 3.10 - replace _Py_fopen() with fopen() (#1912903)
* Fri Nov 20 2020 Jonathan Wakely <jwakely@redhat.com> - 1.73.0-11
- Patch Boost.Locale to not access empty vector (#1899888)