Issue with decorate>=5.0.5 in dogpile.cache.region
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
Research direction
Start in dogpile/cache/region.py at the two CacheRegion decorator calls around lines 1619 and 1859, then review the linked decorator change and the existing local unit-test coverage. Verify the behavior with current and older decorate versions, and consider the open question about preserving compatibility; done means the affected consumers no longer fail without breaking supported dependency versions.
Written by the indexing model from the issue text.
Description
The latest releases of decorate changed the handling of positional args in some cases, see https://github.com/micheles/decorator/commit/04bb6454ac4f7560759ec1a3e15756a5485067ac. This is triggering failures in some consumers, e.g. openstacksdk, see https://storyboard.openstack.org/#!/story/2009114 and https://github.com/micheles/decorator/issues/127. What works for me in local unit testing is adding the kwsyntax=True option like
diff --git a/dogpile/cache/region.py b/dogpile/cache/region.py
index ef0dbc4..561e208 100644
--- a/dogpile/cache/region.py
+++ b/dogpile/cache/region.py
@@ -1619,7 +1619,7 @@ class CacheRegion:
# Use `decorate` to preserve the signature of :param:`user_func`.
return decorate(
- user_func, partial(get_or_create_for_user_func, key_generator)
+ user_func, partial(get_or_create_for_user_func, key_generator), kwsyntax=True
)
return cache_decorator
@@ -1859,7 +1859,7 @@ class CacheRegion:
# Use `decorate` to preserve the signature of :param:`user_func`.
return decorate(
- user_func, partial(get_or_create_for_user_func, key_generator)
+ user_func, partial(get_or_create_for_user_func, key_generator), kwsyntax=True
)
return cache_decorator
But maybe there is also a way to adopt to the new behaviour more smoothly. The above patch will break when using an old version of decorate and I don't know whether there's a better solution then wrapping in a try block and repeating the call without the added option if necessary.
- Dominant language
- Python
- Stars
- 299
- Forks
- 50
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sqlalchemy/dogpile.cache
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
sqlalchemy/dogpile.cache#267 · 3 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
sqlalchemy/dogpile.cache#265 · 4 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
sqlalchemy/dogpile.cache#264 · 4 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
sqlalchemy/dogpile.cache#258 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 42/100
sqlalchemy/dogpile.cache#243 · 2 comments ·
All issues in sqlalchemy/dogpile.cache
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100