commit:     2125c14014ea0276eb6557be523edac854e66fe6
Author:     Holger Hoffstätte <holger <AT> applied-asynchrony <DOT> com>
AuthorDate: Fri Dec  5 14:49:40 2025 +0000
Commit:     Eli Schwartz <eschwartz <AT> gentoo <DOT> org>
CommitDate: Sun Dec  7 21:36:07 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2125c140

dev-libs/boost: test fixes for dll and python in 1.89.0

Signed-off-by: Holger Hoffstätte <holger <AT> applied-asynchrony.com>
Part-of: https://github.com/gentoo/gentoo/pull/44917
Closes: https://github.com/gentoo/gentoo/pull/44917
Signed-off-by: Eli Schwartz <eschwartz <AT> gentoo.org>

 dev-libs/boost/boost-1.89.0.ebuild                 |  11 ++-
 dev-libs/boost/files/boost-1.89.0-dll-no-lto.patch |  14 +++
 .../boost-1.89.0-python-exclude-broken-tests.patch |  28 ++++++
 .../boost/files/boost-1.89.0-python-pickle.patch   | 104 +++++++++++++++++++++
 4 files changed, 153 insertions(+), 4 deletions(-)

diff --git a/dev-libs/boost/boost-1.89.0.ebuild 
b/dev-libs/boost/boost-1.89.0.ebuild
index aa056e2388ec..d70218e01b3c 100644
--- a/dev-libs/boost/boost-1.89.0.ebuild
+++ b/dev-libs/boost/boost-1.89.0.ebuild
@@ -55,8 +55,11 @@ PATCHES=(
        "${FILESDIR}"/${PN}-1.88.0-range-any_iterator.patch
        "${FILESDIR}"/${PN}-1.88.0-system-crashing-test.patch
        "${FILESDIR}"/${PN}-1.88.0-yap-cstdint.patch
+       "${FILESDIR}"/${PN}-1.89.0-dll-no-lto.patch
        "${FILESDIR}"/${PN}-1.89.0-graph-remove-system-dependency.patch
        "${FILESDIR}"/${PN}-1.89.0-predef-include-path.patch
+       "${FILESDIR}"/${PN}-1.89.0-python-exclude-broken-tests.patch
+       "${FILESDIR}"/${PN}-1.89.0-python-pickle.patch
        "${FILESDIR}"/${PN}-1.89.0-unordered-no-tbb.patch
 )
 
@@ -236,13 +239,13 @@ multilib_src_test() {
                "config"
                # undefined reference to `boost::math::concepts::real_concept 
boost::math::bernoulli_b2n<boost::math::concepts::real_concept>(int)
                "math"
-               # PyObject* boost::parameter::python::aux::unspecified_type():
-               #   /usr/include/python3.13/object.h:339:30: error: lvalue 
required as left operand of assignment
+               # In function 'PyObject* 
boost::parameter::python::aux::unspecified_type()':
+               #  /usr/include/python3.13/object.h:339:30: error: lvalue 
required as left operand of assignment
+               #  #define Py_TYPE(ob) Py_TYPE(_PyObject_CAST(ob))
+               #                      ~~~~~~~^~~~~~~~~~~~~~~~~~~~
                "parameter_python"
                # scope/lambda_tests22.cpp(27): test 'x == 1' failed in 
function 'int main()'
                "phoenix"
-               # AttributeError: property '<unnamed Boost.Python function>' of 
'X' object has no setter
-               "python"
                # vec_access.hpp:95:223: error: static assertion failed: Boost 
QVM static assertion failure
                "qvm"
                # Processing file 
../boost_1_89_0/libs/regex/example/../include/boost/regex/v5/regex_iterator.hpp

diff --git a/dev-libs/boost/files/boost-1.89.0-dll-no-lto.patch 
b/dev-libs/boost/files/boost-1.89.0-dll-no-lto.patch
new file mode 100644
index 000000000000..a36e6680bfc8
--- /dev/null
+++ b/dev-libs/boost/files/boost-1.89.0-dll-no-lto.patch
@@ -0,0 +1,14 @@
+Unconditionally disable LTO in case it's injected from the outside.
+LTO breaks the test as some symbols and sections are gone/rearranged.
+
+--- a/libs/dll/test/Jamfile.v2
++++ a/libs/dll/test/Jamfile.v2
+@@ -36,7 +36,7 @@ project
+       [ requires cxx11_static_assert ]
+    # linux
+       <target-os>linux:<linkflags>"-ldl"
+-      <toolset>gcc:<cxxflags>"-Wall -Wextra -pedantic -Wno-long-long"
++      <toolset>gcc:<cxxflags>"-Wall -Wextra -pedantic -Wno-long-long -fno-lto"
+ 
+    # others
+       <local-visibility>hidden

diff --git 
a/dev-libs/boost/files/boost-1.89.0-python-exclude-broken-tests.patch 
b/dev-libs/boost/files/boost-1.89.0-python-exclude-broken-tests.patch
new file mode 100644
index 000000000000..98321d8efd8b
--- /dev/null
+++ b/dev-libs/boost/files/boost-1.89.0-python-exclude-broken-tests.patch
@@ -0,0 +1,28 @@
+Exclude tests that are either obsolete or simply don't work.
+The upcast.cpp test error message looks suspiciously like the
+parameter_python build failure; probably due to a newer Python
+Object API break.
+
+--- a/libs/python/test/Jamfile
++++ b/libs/python/test/Jamfile
+@@ -111,11 +111,6 @@ bpl-test crossmod_exception
+ [ bpl-test andreas_beyer ]
+ [ bpl-test wrapper_held_type ]
+ 
+-[ bpl-test polymorphism2_auto_ptr
+-  : polymorphism2_auto_ptr.py polymorphism2.py polymorphism2_auto_ptr.cpp
+-  : [ requires auto_ptr ]
+-]
+-
+ [ bpl-test polymorphism ]
+ [ bpl-test polymorphism2 ]
+ 
+@@ -239,8 +234,6 @@ bpl-test crossmod_opaque
+ [ py-compile object_manager.cpp ]
+ [ py-compile copy_ctor_mutates_rhs.cpp ]
+ 
+-[ py-run upcast.cpp ]
+-
+ [ py-compile select_holder.cpp ]
+ 
+ [ run select_from_python_test.cpp ../src/converter/type_id.cpp

diff --git a/dev-libs/boost/files/boost-1.89.0-python-pickle.patch 
b/dev-libs/boost/files/boost-1.89.0-python-pickle.patch
new file mode 100644
index 000000000000..dab13c439c73
--- /dev/null
+++ b/dev-libs/boost/files/boost-1.89.0-python-pickle.patch
@@ -0,0 +1,104 @@
+https://github.com/boostorg/python/pull/482
+
+From: Eisuke Kawashima <[email protected]>
+Date: Mon, 31 Mar 2025 19:49:28 +0900
+Subject: [PATCH] fix(test.pickle): fix for change in the return value of 
object.__reduce__()
+
+https://docs.python.org/3.11/library/pickle.html#object.__reduce__
+
+fix #461
+---
+ test/pickle1.py | 26 ++++++++++++++++++++++++--
+ test/pickle4.py | 26 ++++++++++++++++++++++++--
+ 2 files changed, 48 insertions(+), 4 deletions(-)
+
+diff --git a/libs/python/test/pickle1.py b/libs/python/test/pickle1.py
+index b8f4efd9b0..0df59a4b3a 100644
+--- a/libs/python/test/pickle1.py
++++ b/libs/python/test/pickle1.py
+@@ -9,8 +9,10 @@
+     1
+     >>> pickle1_ext.world.__name__
+     'world'
+-    >>> pickle1_ext.world('Hello').__reduce__()
++    >>> pickle1_ext.world('Hello').__reduce__()  # doctest: +PY310
+     (<class 'pickle1_ext.world'>, ('Hello',))
++    >>> pickle1_ext.world('Hello').__reduce__()  # doctest: +PY311
++    (<class 'pickle1_ext.world'>, ('Hello',), None)
+     >>> wd = pickle1_ext.world('California')
+     >>> pstr = pickle.dumps(wd)
+     >>> wl = pickle.loads(pstr)
+@@ -31,7 +33,27 @@ def run(args = None):
+ 
+     if args is not None:
+         sys.argv = args
+-    return doctest.testmod(sys.modules.get(__name__))
++
++    # > https://docs.python.org/3.11/library/pickle.html#object.__reduce__
++    # object.__reduce__() returns
++    # - python 3.10 or prior: a 2-element tuple
++    # - python 3.11 or later: a 3-element tuple (object's state added)
++    PY310 = doctest.register_optionflag("PY310")
++    PY311 = doctest.register_optionflag("PY311")
++
++    class ConditionalChecker(doctest.OutputChecker):
++        def check_output(self, want, got, optionflags):
++            if (optionflags & PY311) and (sys.version_info[:2] < (3, 11)):
++                return True
++            if (optionflags & PY310) and (sys.version_info[:2] >= (3, 11)):
++                return True
++            return doctest.OutputChecker.check_output(self, want, got, 
optionflags)
++
++    runner = doctest.DocTestRunner(ConditionalChecker())
++    for test in doctest.DocTestFinder().find(sys.modules.get(__name__)):
++        runner.run(test)
++
++    return doctest.TestResults(runner.failures, runner.tries)
+     
+ if __name__ == '__main__':
+     print("running...")
+diff --git a/libs/python/test/pickle4.py b/libs/python/test/pickle4.py
+index be813bbb13..3cf4d7241f 100644
+--- a/libs/python/test/pickle4.py
++++ b/libs/python/test/pickle4.py
+@@ -12,8 +12,10 @@
+     1
+     >>> pickle4_ext.world.__name__
+     'world'
+-    >>> pickle4_ext.world('Hello').__reduce__()
++    >>> pickle4_ext.world('Hello').__reduce__()  # doctest: +PY310
+     (<class 'pickle4_ext.world'>, ('Hello',))
++    >>> pickle4_ext.world('Hello').__reduce__()  # doctest: +PY311
++    (<class 'pickle4_ext.world'>, ('Hello',), None)
+     >>> wd = pickle4_ext.world('California')
+     >>> pstr = pickle.dumps(wd)
+     >>> wl = pickle.loads(pstr)
+@@ -29,7 +31,27 @@ def run(args = None):
+ 
+     if args is not None:
+         sys.argv = args
+-    return doctest.testmod(sys.modules.get(__name__))
++
++    # > https://docs.python.org/3.11/library/pickle.html#object.__reduce__
++    # object.__reduce__() returns
++    # - python 3.10 or prior: a 2-element tuple
++    # - python 3.11 or later: a 3-element tuple (object's state added)
++    PY310 = doctest.register_optionflag("PY310")
++    PY311 = doctest.register_optionflag("PY311")
++
++    class ConditionalChecker(doctest.OutputChecker):
++        def check_output(self, want, got, optionflags):
++            if (optionflags & PY311) and (sys.version_info[:2] < (3, 11)):
++                return True
++            if (optionflags & PY310) and (sys.version_info[:2] >= (3, 11)):
++                return True
++            return doctest.OutputChecker.check_output(self, want, got, 
optionflags)
++
++    runner = doctest.DocTestRunner(ConditionalChecker())
++    for test in doctest.DocTestFinder().find(sys.modules.get(__name__)):
++        runner.run(test)
++
++    return doctest.TestResults(runner.failures, runner.tries)
+     
+ if __name__ == '__main__':
+     print("running...")

Reply via email to