Skip to content

Commit 8135478

Browse files
committed
Fix compatibility with aiosqlite 0.22.1+
1 parent b33b5da commit 8135478

6 files changed

Lines changed: 253 additions & 232 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
- uses: supercharge/mongodb-github-action@1.12.1
4848
with:
4949
mongodb-version: '5.0'
50-
- uses: supercharge/redis-github-action@1.8.1
50+
- uses: supercharge/redis-github-action@2
5151
with:
5252
redis-version: '6'
5353
- uses: rrainn/dynamodb-action@v4.0.0

HISTORY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# History
22

3+
## 0.14.3 (2026-01-07)
4+
5+
- Fix compatibility with aiosqlite 0.22.1+
6+
37
## 0.14.2 (2025-10-30)
48

59
- Fixed `include_headers` to apply to `CachedSession.headers`

aiohttp_client_cache/backends/sqlite.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,15 @@ def __del__(self):
149149
"""If the aiosqlite connection is still open when this object is deleted, force its thread
150150
to close by stopping its internal queue. This is basically a last resort to avoid hanging
151151
the application if this backend is used without the CachedSession contextmanager.
152-
153-
Note: Since this uses internal attributes, it has the potential to break in future versions
154-
of aiosqlite.
155152
"""
156153
if self._connection is not None:
157154
try:
158-
self._connection._stop_running()
155+
# aiosqlite >= 0.22.1
156+
if hasattr(self._connection, 'stop'):
157+
self._connection.stop()
158+
# aiosqlite <= 0.22.0
159+
else:
160+
self._connection._stop_running()
159161
except (AttributeError, TypeError):
160162
logger.warning('Could not close SQLite connection thread', exc_info=True)
161163
self._connection = None

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "aiohttp-client-cache"
3-
version = "0.14.2"
3+
version = "0.14.3"
44
description = "Persistent cache for aiohttp requests"
55
authors = [{name = "Jordan Cook"}, {name = "Alessio Locatelli"}]
66
license = {text = "MIT License"}

test/integration/test_sqlite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ async def test_failed_thread_close(self):
109109
async with self.init_cache(self.storage_class) as cache:
110110
async with cache.get_connection():
111111
pass
112-
with patch.object(aiosqlite.Connection, '_stop_running', side_effect=AttributeError):
112+
with patch.object(aiosqlite.Connection, 'stop', side_effect=AttributeError):
113113
del cache
114114

115115
# TODO: Tests for unimplemented features

0 commit comments

Comments
 (0)