Skip to content

Commit eed7d78

Browse files
Support Python 3.14 (#528)
Signed-off-by: Sandro Bonazzola <[email protected]>
1 parent 077aaa8 commit eed7d78

File tree

9 files changed

+24
-23
lines changed

9 files changed

+24
-23
lines changed

.github/workflows/ci.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ jobs:
2626
tox: py311
2727
- python: "3.12"
2828
tox: py312
29-
- python: "3.12"
30-
tox: pep8
3129
- python: "3.13"
32-
tox: py313,py313-trio
33-
- python: "3.11"
30+
tox: py313
31+
- python: "3.14"
32+
tox: py314,py314-trio
33+
- python: "3.14"
34+
tox: pep8
35+
- python: "3.14"
3436
tox: mypy
3537
steps:
3638
- name: Checkout 🛎️

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
- uses: actions/[email protected]
2222
with:
23-
python-version: 3.13
23+
python-version: 3.14
2424

2525
- name: Install build
2626
run: |

.mergify.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ queue_rules:
1414
- "check-success=test (3.10, py310)"
1515
- "check-success=test (3.11, py311)"
1616
- "check-success=test (3.12, py312)"
17-
- "check-success=test (3.13, py313,py313-trio)"
18-
- "check-success=test (3.12, pep8)"
17+
- "check-success=test (3.13, py313)"
18+
- "check-success=test (3.14, py314,py314-trio)"
19+
- "check-success=test (3.14, pep8)"
1920

2021
pull_request_rules:
2122
- name: warn on no changelog
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
features:
3+
- Python 3.14 support has been added.

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ classifier =
1818
Programming Language :: Python :: 3.11
1919
Programming Language :: Python :: 3.12
2020
Programming Language :: Python :: 3.13
21+
Programming Language :: Python :: 3.14
2122
Topic :: Utilities
2223

2324
[options]

tenacity/__init__.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -307,19 +307,15 @@ def statistics(self) -> t.Dict[str, t.Any]:
307307
future we may provide a way to aggregate the various
308308
statistics from each thread).
309309
"""
310-
try:
311-
return self._local.statistics # type: ignore[no-any-return]
312-
except AttributeError:
310+
if not hasattr(self._local, "statistics"):
313311
self._local.statistics = t.cast(t.Dict[str, t.Any], {})
314-
return self._local.statistics
312+
return self._local.statistics # type: ignore[no-any-return]
315313

316314
@property
317315
def iter_state(self) -> IterState:
318-
try:
319-
return self._local.iter_state # type: ignore[no-any-return]
320-
except AttributeError:
316+
if not hasattr(self._local, "iter_state"):
321317
self._local.iter_state = IterState()
322-
return self._local.iter_state
318+
return self._local.iter_state # type: ignore[no-any-return]
323319

324320
def wraps(self, f: WrappedFn) -> WrappedFn:
325321
"""Wrap a function for retrying.

tests/test_asyncio.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@
4040
def asynctest(callable_):
4141
@wraps(callable_)
4242
def wrapper(*a, **kw):
43-
loop = asyncio.get_event_loop()
44-
return loop.run_until_complete(callable_(*a, **kw))
43+
return asyncio.run(callable_(*a, **kw))
4544

4645
return wrapper
4746

tests/test_issue_478.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ def asynctest(
1212
) -> typing.Callable[..., typing.Any]:
1313
@wraps(callable_)
1414
def wrapper(*a: typing.Any, **kw: typing.Any) -> typing.Any:
15-
loop = asyncio.get_event_loop()
16-
return loop.run_until_complete(callable_(*a, **kw))
15+
return asyncio.run(callable_(*a, **kw))
1716

1817
return wrapper
1918

tox.ini

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tox]
22
# we only test trio on latest python version
3-
envlist = py3{9,10,11,12,13,13-trio}, pep8, pypy3
3+
envlist = py3{9,10,11,12,13,14,14-trio}, pep8, pypy3
44
skip_missing_interpreters = True
55

66
[testenv]
@@ -11,9 +11,9 @@ deps =
1111
.[doc]
1212
trio: trio
1313
commands =
14-
py3{8,9,10,11,12,13},pypy3: pytest {posargs}
15-
py3{8,9,10,11,12,13},pypy3: sphinx-build -a -E -W -b doctest doc/source doc/build
16-
py3{8,9,10,11,12,13},pypy3: sphinx-build -a -E -W -b html doc/source doc/build
14+
py3{8,9,10,11,12,13,14},pypy3: pytest {posargs}
15+
py3{8,9,10,11,12,13,14},pypy3: sphinx-build -a -E -W -b doctest doc/source doc/build
16+
py3{8,9,10,11,12,13,14},pypy3: sphinx-build -a -E -W -b html doc/source doc/build
1717

1818
[testenv:pep8]
1919
basepython = python3

0 commit comments

Comments
 (0)