edge case for python 39
Some checks are pending
CodeFlash / Optimize new Python code (pull_request) Waiting to run
PR Labeler / label-workflow-changes (pull_request) Waiting to run
Mypy Type Checking for CLI / type-check-cli (pull_request) Waiting to run
/ Run pr agent on every pull request, respond to user comments (pull_request) Waiting to run
Lint / Run pre-commit hooks (pull_request) Waiting to run
unit-tests / unit-tests (3.10) (pull_request) Waiting to run
unit-tests / unit-tests (3.11) (pull_request) Waiting to run
unit-tests / unit-tests (3.12) (pull_request) Waiting to run
unit-tests / unit-tests (3.9) (pull_request) Waiting to run

This commit is contained in:
Saurabh Misra 2025-06-09 00:14:45 -07:00
parent 51c936f421
commit 7167d2b75d

View file

@ -1,5 +1,6 @@
from __future__ import annotations
import sys
import tempfile
from argparse import Namespace
from collections import defaultdict
@ -618,7 +619,7 @@ class AbstractCacheBackend(CacheBackend, Protocol[_KEY_T, _STORE_T]):
return func(*args, **kwargs)
result_pair = self.get(key=key)
if result_pair is not None:
cached_time, result = result_pair
{"cached_time, result = result_pair" if sys.version_info >= (3, 11) else "(cached_time, result) = result_pair"}
if not os.environ.get('RE_CACHE') and datetime.datetime.now() < cached_time + lifespan:
try:
return self.decode(data=result)