From 148391a5a9a63785c6daaf6a82eb5bd72ac29272 Mon Sep 17 00:00:00 2001 From: Zach van Rijn Date: Sun, 27 Nov 2022 11:01:15 -0600 Subject: user/boost: add patches for python 3.11. fixes #890. --- user/boost/APKBUILD | 11 +++++++--- user/boost/python-311-fix-enum.patch | 39 ++++++++++++++++++++++++++++++++++++ user/boost/python-311-fix-open.patch | 22 ++++++++++++++++++++ 3 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 user/boost/python-311-fix-enum.patch create mode 100644 user/boost/python-311-fix-open.patch (limited to 'user') diff --git a/user/boost/APKBUILD b/user/boost/APKBUILD index 2d013729c..9e8e7f9f0 100644 --- a/user/boost/APKBUILD +++ b/user/boost/APKBUILD @@ -3,7 +3,7 @@ pkgname=boost pkgver=1.79.0 _pkgver=$(printf '%s' "$pkgver" | tr . _) -pkgrel=0 +pkgrel=1 pkgdesc="Free peer-reviewed portable C++ source libraries" url="https://www.boost.org/" arch="all" @@ -13,7 +13,10 @@ depends_dev="linux-headers" makedepends="$depends_dev byacc bzip2-dev flex python3-dev xz-dev zlib-dev zstd-dev" subpackages="$pkgname-dev $pkgname-doc" -source="https://boostorg.jfrog.io/artifactory/main/release/${pkgver}/source/${pkgname}_${_pkgver}.tar.bz2" +source="https://boostorg.jfrog.io/artifactory/main/release/${pkgver}/source/${pkgname}_${_pkgver}.tar.bz2 + python-311-fix-enum.patch + python-311-fix-open.patch + " builddir="$srcdir/${pkgname}_${_pkgver}" @@ -146,4 +149,6 @@ _pyversion() { $1 -c 'import sys; print("%i.%i" % (sys.version_info.major, sys.version_info.minor))' } -sha512sums="70909e0561c213d10a1fdd692f9ae7b293d3cdc63e925bdc207da9e9bba6e86474341100e7ee5de6d94f9561196b1a3a1597055a7b7382babf8931131170a312 boost_1_79_0.tar.bz2" +sha512sums="70909e0561c213d10a1fdd692f9ae7b293d3cdc63e925bdc207da9e9bba6e86474341100e7ee5de6d94f9561196b1a3a1597055a7b7382babf8931131170a312 boost_1_79_0.tar.bz2 +04b9bcbd37cf660450aa4ff27b32db514d669caa378a25158d6d1e71ef0b42ea097e9dfda01774fbe80487db0f80d809d10b42e5ebc464f9faff02379bead98d python-311-fix-enum.patch +4b517dc36719e4e4666d32822a65e650496f9ec534232ae96500538bf8182ce72e08bda3786a598330babda1bc169afa9b38fbc9d5a63d2dc633c03ba428a060 python-311-fix-open.patch" diff --git a/user/boost/python-311-fix-enum.patch b/user/boost/python-311-fix-enum.patch new file mode 100644 index 000000000..02e0cf2c7 --- /dev/null +++ b/user/boost/python-311-fix-enum.patch @@ -0,0 +1,39 @@ +https://github.com/boostorg/python/pull/385 + +Patch modified to include 'libs/python/' prefix. + +From ae5da2a7e8f1111757d8a474095486a5b22aa12d Mon Sep 17 00:00:00 2001 +From: Victor Stinner +Date: Mon, 25 Apr 2022 10:51:46 +0200 +Subject: [PATCH] Fix enum_type_object type on Python 3.11 + +The enum_type_object type inherits from PyLong_Type which is not tracked +by the GC. Instances doesn't have to be tracked by the GC: remove the +Py_TPFLAGS_HAVE_GC flag. + +The Python C API documentation says: + + "To create a container type, the tp_flags field of the type object + must include the Py_TPFLAGS_HAVE_GC and provide an implementation of + the tp_traverse handler." + +https://docs.python.org/dev/c-api/gcsupport.html + +The new exception was introduced in Python 3.11 by: +https://github.com/python/cpython/issues/88429 +--- + src/object/enum.cpp | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/object/enum.cpp b/src/object/enum.cpp +index 293e705899..5753b32e07 100644 +--- a/libs/python/src/object/enum.cpp ++++ b/libs/python/src/object/enum.cpp +@@ -113,7 +113,6 @@ static PyTypeObject enum_type_object = { + #if PY_VERSION_HEX < 0x03000000 + | Py_TPFLAGS_CHECKTYPES + #endif +- | Py_TPFLAGS_HAVE_GC + | Py_TPFLAGS_BASETYPE, /* tp_flags */ + 0, /* tp_doc */ + 0, /* tp_traverse */ diff --git a/user/boost/python-311-fix-open.patch b/user/boost/python-311-fix-open.patch new file mode 100644 index 000000000..4d238d3a2 --- /dev/null +++ b/user/boost/python-311-fix-open.patch @@ -0,0 +1,22 @@ +https://docs.python.org/3/whatsnew/3.11.html#porting-to-python-3-11 + +open(), io.open(), codecs.open() and fileinput.FileInput no +longer accept 'U' (“universal newline”) in the file mode. + +In Python 3, “universal newline” mode is used by default +whenever a file is opened in text mode, and the 'U' flag +has been deprecated since Python 3.3. The newline parameter +to these functions controls how universal newlines work. + +diff -ur a/tools/build/test/BoostBuild.py b/tools/build/test/BoostBuild.py +--- a/tools/build/test/BoostBuild.py 2022-11-27 10:51:49.323319793 -0600 ++++ b/tools/build/test/BoostBuild.py 2022-11-27 10:52:31.636168392 -0600 +@@ -579,8 +579,6 @@ + openMode = "r" + if binary: + openMode += "b" +- else: +- openMode += "U" + f = open(name, openMode) + result = f.read() + f.close() -- cgit v1.2.3-70-g09d2