dateparser icon indicating copy to clipboard operation
dateparser copied to clipboard

Reject negative cache size limits

Open CodingFeng101 opened this issue 5 months ago • 1 comments

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 0 and positive limits unchanged.

Validation

  • python -m pytest tests/test_cache_size_limit.py -q -> 1 passed
  • Manual smoke check confirmed CACHE_SIZE_LIMIT values 0 and 1 are still accepted.

CodingFeng101 avatar Jun 20 '26 01:06 CodingFeng101

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.

AdrianAtZyte avatar Jun 22 '26 06:06 AdrianAtZyte