dateparser
dateparser copied to clipboard
Reject negative cache size limits
Summary
Reject negative CACHE_SIZE_LIMIT values during settings validation. The setting is used as a cache-size limit, but negative integers are currently accepted and make the cache eviction condition true immediately after entries are added.
Changes
- Add a non-negative validation check for
CACHE_SIZE_LIMIT. - Add a focused regression test for negative values.
- Keep the existing behavior for
0and positive limits unchanged.
Validation
python -m pytest tests/test_cache_size_limit.py -q->1 passed- Manual smoke check confirmed
CACHE_SIZE_LIMITvalues0and1are still accepted.
I don’t see how a user could do this accidentally, and it does not sound like a big issue if they do, so I am not sure this is worth it.
Also, please don’t spam PRs, specially PRs without issues confirming what they address needs to be addressed.