commit:     e4239783aa7f527d857065643326d09b189314fa
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov  1 18:32:44 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Nov  1 18:34:55 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e4239783

dev-python/tenacity: enable py3.14

Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../tenacity/files/tenacity-9.1.2-py3.14.patch     | 70 ++++++++++++++++++++++
 dev-python/tenacity/tenacity-9.1.2-r1.ebuild       | 43 +++++++++++++
 2 files changed, 113 insertions(+)

diff --git a/dev-python/tenacity/files/tenacity-9.1.2-py3.14.patch 
b/dev-python/tenacity/files/tenacity-9.1.2-py3.14.patch
new file mode 100644
index 000000000000..43d4d7b3d572
--- /dev/null
+++ b/dev-python/tenacity/files/tenacity-9.1.2-py3.14.patch
@@ -0,0 +1,70 @@
+https://github.com/jd/tenacity/commit/eed7d785e667df145c0e3eeddff59af64e4e860d
+
+From eed7d785e667df145c0e3eeddff59af64e4e860d Mon Sep 17 00:00:00 2001
+From: Sandro Bonazzola <[email protected]>
+Date: Fri, 27 Jun 2025 10:18:58 +0200
+Subject: [PATCH] Support Python 3.14 (#528)
+
+Signed-off-by: Sandro Bonazzola <[email protected]>
+---
+ tenacity/__init__.py                                 | 12 ++++--------
+ tests/test_asyncio.py                                |  3 +--
+ tests/test_issue_478.py                              |  3 +--
+ 9 files changed, 24 insertions(+), 23 deletions(-)
+
+diff --git a/tenacity/__init__.py b/tenacity/__init__.py
+index e274c215..e93793cc 100644
+--- a/tenacity/__init__.py
++++ b/tenacity/__init__.py
+@@ -307,19 +307,15 @@ def statistics(self) -> t.Dict[str, t.Any]:
+                   future we may provide a way to aggregate the various
+                   statistics from each thread).
+         """
+-        try:
+-            return self._local.statistics  # type: ignore[no-any-return]
+-        except AttributeError:
++        if not hasattr(self._local, "statistics"):
+             self._local.statistics = t.cast(t.Dict[str, t.Any], {})
+-            return self._local.statistics
++        return self._local.statistics  # type: ignore[no-any-return]
+ 
+     @property
+     def iter_state(self) -> IterState:
+-        try:
+-            return self._local.iter_state  # type: ignore[no-any-return]
+-        except AttributeError:
++        if not hasattr(self._local, "iter_state"):
+             self._local.iter_state = IterState()
+-            return self._local.iter_state
++        return self._local.iter_state  # type: ignore[no-any-return]
+ 
+     def wraps(self, f: WrappedFn) -> WrappedFn:
+         """Wrap a function for retrying.
+diff --git a/tests/test_asyncio.py b/tests/test_asyncio.py
+index 0b74476b..f6793f0b 100644
+--- a/tests/test_asyncio.py
++++ b/tests/test_asyncio.py
+@@ -40,8 +40,7 @@
+ def asynctest(callable_):
+     @wraps(callable_)
+     def wrapper(*a, **kw):
+-        loop = asyncio.get_event_loop()
+-        return loop.run_until_complete(callable_(*a, **kw))
++        return asyncio.run(callable_(*a, **kw))
+ 
+     return wrapper
+ 
+diff --git a/tests/test_issue_478.py b/tests/test_issue_478.py
+index 7489ad7c..83182ac4 100644
+--- a/tests/test_issue_478.py
++++ b/tests/test_issue_478.py
+@@ -12,8 +12,7 @@ def asynctest(
+ ) -> typing.Callable[..., typing.Any]:
+     @wraps(callable_)
+     def wrapper(*a: typing.Any, **kw: typing.Any) -> typing.Any:
+-        loop = asyncio.get_event_loop()
+-        return loop.run_until_complete(callable_(*a, **kw))
++        return asyncio.run(callable_(*a, **kw))
+ 
+     return wrapper
+ 

diff --git a/dev-python/tenacity/tenacity-9.1.2-r1.ebuild 
b/dev-python/tenacity/tenacity-9.1.2-r1.ebuild
new file mode 100644
index 000000000000..92b9faed1e42
--- /dev/null
+++ b/dev-python/tenacity/tenacity-9.1.2-r1.ebuild
@@ -0,0 +1,43 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( pypy3_11 python3_{11..14} )
+
+inherit distutils-r1 pypi
+
+DESCRIPTION="General-purpose retrying library"
+HOMEPAGE="
+       https://github.com/jd/tenacity/
+       https://pypi.org/project/tenacity/
+"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~m68k ~ppc ~ppc64 ~riscv ~sparc ~x86"
+
+BDEPEND="
+       dev-python/setuptools-scm[${PYTHON_USEDEP}]
+       test? (
+               >=dev-python/tornado-6.4-r1[${PYTHON_USEDEP}]
+               dev-python/typeguard[${PYTHON_USEDEP}]
+       )
+"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-9.1.2-py3.14.patch
+)
+
+distutils_enable_tests pytest
+
+python_test() {
+       local EPYTEST_DESELECT=(
+               # fragile to timing
+               tests/test_asyncio.py::TestContextManager::test_sleeps
+       )
+
+       local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
+       epytest
+}

Reply via email to