Skip to content

Forward keyword-only arguments to cache refresh callbacks - #684

Open
jackwalkerlabs wants to merge 1 commit into
pallets-eco:stablefrom
jackwalkerlabs:fix/keyword-only-cache-callbacks
Open

jackwalkerlabs wants to merge 1 commit into
pallets-eco:stablefrom
jackwalkerlabs:fix/keyword-only-cache-callbacks

Conversation

@jackwalkerlabs

Copy link
Copy Markdown

forced_update(*, item_id) is called without item_id, and is_stale(value, *, item_id) has the same problem: the signature helpers ignore keyword-only parameters. This raises TypeError in debug mode and silently bypasses caching otherwise. Include keyword-only parameters when deciding whether to forward decorated-function arguments.

Found during source inspection. All four regression cases fail before this change, covering cached and memoize with both callbacks. Validation on Python 3.12/macOS: 172 passed, 8 skipped, 1 deselected, excluding backend integration files and the unavailable Memcached case. Mypy passes; Pyright reports 0 errors (one unavailable uwsgi-runtime warning); all pre-commit hooks pass.

Test command: pytest tests --ignore=tests/test_backend_cache.py --ignore=tests/test_cachelib.py -k 'not Memcached' -q.

Implemented and tested using Codex under the submitting account's authorization.

Implemented and validated with Codex.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant