From c2ffa2e7afb9dc45c762fe8d9ddb79c43a5046f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Fri, 7 Mar 2025 15:27:21 +0100 Subject: [PATCH] dev-python/tblib: Enable pypy3.11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- dev-python/tblib/files/tblib-3.0.0-test.patch | 35 +++++++++++++++++++ dev-python/tblib/tblib-3.0.0.ebuild | 9 +++-- 2 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 dev-python/tblib/files/tblib-3.0.0-test.patch diff --git a/dev-python/tblib/files/tblib-3.0.0-test.patch b/dev-python/tblib/files/tblib-3.0.0-test.patch new file mode 100644 index 0000000000000..fb1aed1344d5f --- /dev/null +++ b/dev-python/tblib/files/tblib-3.0.0-test.patch @@ -0,0 +1,35 @@ +diff --git a/tests/test_pickle_exception.py b/tests/test_pickle_exception.py +index 5ff4679..53a9dce 100644 +--- a/tests/test_pickle_exception.py ++++ b/tests/test_pickle_exception.py +@@ -29,6 +29,10 @@ class CustomError(Exception): + pass + + ++def strip_locations(tb_text): ++ return tb_text.replace(' ~~^~~\n', '').replace(' ^^^^^^^^^^^^^^^^^\n', '') ++ ++ + @pytest.mark.parametrize('protocol', [None, *list(range(1, pickle.HIGHEST_PROTOCOL + 1))]) + @pytest.mark.parametrize('how', ['global', 'instance', 'class']) + def test_install(clear_dispatch_table, how, protocol): +@@ -58,8 +62,8 @@ def test_install(clear_dispatch_table, how, protocol): + else: + raise AssertionError + +- expected_format_exception = ''.join(format_exception(type(exc), exc, exc.__traceback__)) +- print(expected_format_exception) ++ expected_format_exception = strip_locations(''.join(format_exception(type(exc), exc, exc.__traceback__))) ++ + # Populate Exception.__dict__, which is used in some cases + exc.x = 1 + exc.__cause__.x = 2 +@@ -88,7 +92,7 @@ def test_install(clear_dispatch_table, how, protocol): + if has_python311: + assert exc.__notes__ == ['note 1', 'note 2'] + +- assert expected_format_exception == ''.join(format_exception(type(exc), exc, exc.__traceback__)) ++ assert expected_format_exception == strip_locations(''.join(format_exception(type(exc), exc, exc.__traceback__))) + + + @tblib.pickling_support.install diff --git a/dev-python/tblib/tblib-3.0.0.ebuild b/dev-python/tblib/tblib-3.0.0.ebuild index a16181b168e7c..ce963787db28a 100644 --- a/dev-python/tblib/tblib-3.0.0.ebuild +++ b/dev-python/tblib/tblib-3.0.0.ebuild @@ -1,10 +1,10 @@ -# Copyright 1999-2024 Gentoo Authors +# Copyright 1999-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 DISTUTILS_USE_PEP517=setuptools -PYTHON_COMPAT=( python3_{10..13} pypy3 ) +PYTHON_COMPAT=( python3_{10..13} pypy3 pypy3_11 ) inherit distutils-r1 pypi @@ -29,6 +29,11 @@ BDEPEND=" distutils_enable_tests pytest +PATCHES=( + # combined fixes from https://github.com/ionelmc/python-tblib/issues/74 + "${FILESDIR}/${P}-test.patch" +) + python_test() { local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 local -x PYTHONNODEBUGRANGES=yes