forked from pool/python-async-lru
Compare commits
4 Commits
| Author | SHA256 | Date | |
|---|---|---|---|
| 410fe5c9a9 | |||
| 0a6261a840 | |||
| 12377ab88c | |||
| a6b61a1989 |
BIN
async-lru-2.0.4.tar.gz
LFS
BIN
async-lru-2.0.4.tar.gz
LFS
Binary file not shown.
3
async_lru-2.0.5.tar.gz
Normal file
3
async_lru-2.0.5.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:481d52ccdd27275f42c43a928b4a50c3bfb2d67af4e78b170e3e0bb39c66e5bb
|
||||||
|
size 10380
|
||||||
@@ -1,3 +1,16 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Oct 31 01:17:05 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
|
||||||
|
|
||||||
|
- Add patch support-python-314.patch:
|
||||||
|
* Support Python 3.14 removals.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed May 14 09:27:21 UTC 2025 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
|
||||||
|
|
||||||
|
- Update to 2.0.5
|
||||||
|
* Fixed a memory leak on exceptions and minor performance improvement.
|
||||||
|
- Adjust upstream source name in spec file
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sat Jul 29 09:02:08 UTC 2023 - Dirk Müller <dmueller@suse.com>
|
Sat Jul 29 09:02:08 UTC 2023 - Dirk Müller <dmueller@suse.com>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package python-async-lru
|
# spec file for package python-async-lru
|
||||||
#
|
#
|
||||||
# Copyright (c) 2023 SUSE LLC
|
# Copyright (c) 2025 SUSE LLC and contributors
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@@ -18,25 +18,25 @@
|
|||||||
|
|
||||||
%{?sle15_python_module_pythons}
|
%{?sle15_python_module_pythons}
|
||||||
Name: python-async-lru
|
Name: python-async-lru
|
||||||
Version: 2.0.4
|
Version: 2.0.5
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Simple LRU cache for asyncio
|
Summary: Simple LRU cache for asyncio
|
||||||
License: MIT
|
License: MIT
|
||||||
URL: https://github.com/aio-libs/async-lru
|
URL: https://github.com/aio-libs/async-lru
|
||||||
Source: https://files.pythonhosted.org/packages/source/a/async-lru/async-lru-%{version}.tar.gz
|
Source: https://files.pythonhosted.org/packages/source/a/async_lru/async_lru-%{version}.tar.gz
|
||||||
|
# PATCH-FIX-UPSTREAM Based on gh#aio-libs/async-lru#637
|
||||||
|
Patch0: support-python-314.patch
|
||||||
BuildRequires: %{python_module pip}
|
BuildRequires: %{python_module pip}
|
||||||
BuildRequires: %{python_module setuptools}
|
BuildRequires: %{python_module setuptools}
|
||||||
BuildRequires: %{python_module wheel}
|
BuildRequires: %{python_module wheel}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
Requires: python-typing_extensions >= 4.0.0
|
|
||||||
Provides: python-async_lru = %{version}-%{release}
|
Provides: python-async_lru = %{version}-%{release}
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
# SECTION test requirements
|
# SECTION test requirements
|
||||||
BuildRequires: %{python_module pytest-asyncio}
|
BuildRequires: %{python_module pytest-asyncio}
|
||||||
BuildRequires: %{python_module pytest-timeout}
|
BuildRequires: %{python_module pytest-timeout}
|
||||||
BuildRequires: %{python_module pytest}
|
BuildRequires: %{python_module pytest}
|
||||||
BuildRequires: %{python_module typing_extensions >= 4.0.0}
|
|
||||||
# /SECTION
|
# /SECTION
|
||||||
%python_subpackages
|
%python_subpackages
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ result in 1 call to the wrapped function, with all awaits receiving the result o
|
|||||||
call when it completes.
|
call when it completes.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -p1 -n async-lru-%{version}
|
%autosetup -p1 -n async_lru-%{version}
|
||||||
sed -i /addopts/d setup.cfg
|
sed -i /addopts/d setup.cfg
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
|||||||
125
support-python-314.patch
Normal file
125
support-python-314.patch
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
From c2a83bb41ca6ffd964854d0fe9c6014e5356ad2c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Lumir Balhar <lbalhar@redhat.com>
|
||||||
|
Date: Fri, 17 Jan 2025 14:57:03 +0100
|
||||||
|
Subject: [PATCH 01/20] Switch from asyncio.iscoroutinefunction to inspect for
|
||||||
|
Py 3.14+.
|
||||||
|
|
||||||
|
The former causes: DeprecationWarning:
|
||||||
|
'asyncio.iscoroutinefunction' is deprecated and slated for removal
|
||||||
|
in Python 3.16; use inspect.iscoroutinefunction() instead.
|
||||||
|
|
||||||
|
Fixes: https://github.com/aio-libs/async-lru/issues/635
|
||||||
|
---
|
||||||
|
async_lru/__init__.py | 8 +++++++-
|
||||||
|
tests/test_basic.py | 9 +++++----
|
||||||
|
2 files changed, 12 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
Index: async_lru-2.0.5/async_lru/__init__.py
|
||||||
|
===================================================================
|
||||||
|
--- async_lru-2.0.5.orig/async_lru/__init__.py
|
||||||
|
+++ async_lru-2.0.5/async_lru/__init__.py
|
||||||
|
@@ -1,7 +1,7 @@
|
||||||
|
import asyncio
|
||||||
|
import dataclasses
|
||||||
|
+import inspect
|
||||||
|
import sys
|
||||||
|
-from asyncio.coroutines import _is_coroutine # type: ignore[attr-defined]
|
||||||
|
from functools import _CacheInfo, _make_key, partial, partialmethod
|
||||||
|
from typing import (
|
||||||
|
Any,
|
||||||
|
@@ -27,6 +27,9 @@ if sys.version_info >= (3, 11):
|
||||||
|
else:
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
|
+if sys.version_info < (3, 14):
|
||||||
|
+ from asyncio.coroutines import _is_coroutine # type: ignore[attr-defined]
|
||||||
|
+
|
||||||
|
|
||||||
|
__version__ = "2.0.5"
|
||||||
|
|
||||||
|
@@ -95,7 +98,8 @@ class _LRUCacheWrapper(Generic[_R]):
|
||||||
|
pass
|
||||||
|
# set __wrapped__ last so we don't inadvertently copy it
|
||||||
|
# from the wrapped function when updating __dict__
|
||||||
|
- self._is_coroutine = _is_coroutine
|
||||||
|
+ if sys.version_info < (3, 14):
|
||||||
|
+ self._is_coroutine = _is_coroutine
|
||||||
|
self.__wrapped__ = fn
|
||||||
|
self.__maxsize = maxsize
|
||||||
|
self.__typed = typed
|
||||||
|
@@ -262,7 +266,8 @@ class _LRUCacheWrapperInstanceMethod(Gen
|
||||||
|
pass
|
||||||
|
# set __wrapped__ last so we don't inadvertently copy it
|
||||||
|
# from the wrapped function when updating __dict__
|
||||||
|
- self._is_coroutine = _is_coroutine
|
||||||
|
+ if sys.version_info < (3, 14):
|
||||||
|
+ self._is_coroutine = _is_coroutine
|
||||||
|
self.__wrapped__ = wrapper.__wrapped__
|
||||||
|
self.__instance = instance
|
||||||
|
self.__wrapper = wrapper
|
||||||
|
@@ -299,14 +304,17 @@ def _make_wrapper(
|
||||||
|
while isinstance(origin, (partial, partialmethod)):
|
||||||
|
origin = origin.func
|
||||||
|
|
||||||
|
- if not asyncio.iscoroutinefunction(origin):
|
||||||
|
+ if not inspect.iscoroutinefunction(origin):
|
||||||
|
raise RuntimeError(f"Coroutine function is required, got {fn!r}")
|
||||||
|
|
||||||
|
# functools.partialmethod support
|
||||||
|
if hasattr(fn, "_make_unbound_method"):
|
||||||
|
fn = fn._make_unbound_method()
|
||||||
|
|
||||||
|
- return _LRUCacheWrapper(cast(_CB[_R], fn), maxsize, typed, ttl)
|
||||||
|
+ wrapper = _LRUCacheWrapper(cast(_CB[_R], fn), maxsize, typed, ttl)
|
||||||
|
+ if sys.version_info >= (3, 12):
|
||||||
|
+ wrapper = inspect.markcoroutinefunction(wrapper)
|
||||||
|
+ return wrapper
|
||||||
|
|
||||||
|
return wrapper
|
||||||
|
|
||||||
|
Index: async_lru-2.0.5/tests/test_basic.py
|
||||||
|
===================================================================
|
||||||
|
--- async_lru-2.0.5.orig/tests/test_basic.py
|
||||||
|
+++ async_lru-2.0.5/tests/test_basic.py
|
||||||
|
@@ -1,4 +1,5 @@
|
||||||
|
import asyncio
|
||||||
|
+import inspect
|
||||||
|
import platform
|
||||||
|
import sys
|
||||||
|
from functools import _CacheInfo, partial
|
||||||
|
@@ -27,7 +28,10 @@ async def test_alru_cache_deco(check_lru
|
||||||
|
async def coro() -> None:
|
||||||
|
pass
|
||||||
|
|
||||||
|
- assert asyncio.iscoroutinefunction(coro)
|
||||||
|
+ if sys.version_info >= (3, 12):
|
||||||
|
+ assert inspect.iscoroutinefunction(coro)
|
||||||
|
+ if sys.version_info < (3, 14):
|
||||||
|
+ assert asyncio.iscoroutinefunction(coro)
|
||||||
|
|
||||||
|
check_lru(coro, hits=0, misses=0, cache=0, tasks=0)
|
||||||
|
|
||||||
|
@@ -41,7 +45,10 @@ async def test_alru_cache_deco_called(ch
|
||||||
|
async def coro() -> None:
|
||||||
|
pass
|
||||||
|
|
||||||
|
- assert asyncio.iscoroutinefunction(coro)
|
||||||
|
+ if sys.version_info >= (3, 12):
|
||||||
|
+ assert inspect.iscoroutinefunction(coro)
|
||||||
|
+ if sys.version_info < (3, 14):
|
||||||
|
+ assert asyncio.iscoroutinefunction(coro)
|
||||||
|
|
||||||
|
check_lru(coro, hits=0, misses=0, cache=0, tasks=0)
|
||||||
|
|
||||||
|
@@ -56,7 +63,10 @@ async def test_alru_cache_fn_called(chec
|
||||||
|
|
||||||
|
coro_wrapped = alru_cache(coro)
|
||||||
|
|
||||||
|
- assert asyncio.iscoroutinefunction(coro_wrapped)
|
||||||
|
+ if sys.version_info >= (3, 12):
|
||||||
|
+ assert inspect.iscoroutinefunction(coro_wrapped)
|
||||||
|
+ if sys.version_info < (3, 14):
|
||||||
|
+ assert asyncio.iscoroutinefunction(coro)
|
||||||
|
|
||||||
|
check_lru(coro_wrapped, hits=0, misses=0, cache=0, tasks=0)
|
||||||
|
|
||||||
Reference in New Issue
Block a user