From ed871b3afb8c9e4271e33e8dbf87423420aa904d Mon Sep 17 00:00:00 2001 From: anthony sottile Date: Fri, 14 Jun 2024 09:40:02 -0400 Subject: [PATCH] ref: remove incr_version / decr_version these methods are unsafe with our usage of cache --- django-stubs/core/cache/backends/base.pyi | 4 ---- scripts/stubtest/allowlist.txt | 6 ++++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/django-stubs/core/cache/backends/base.pyi b/django-stubs/core/cache/backends/base.pyi index 236436c28..cc27e5468 100644 --- a/django-stubs/core/cache/backends/base.pyi +++ b/django-stubs/core/cache/backends/base.pyi @@ -60,10 +60,6 @@ class BaseCache: async def adelete_many(self, keys: Iterable[Any], version: Any | None = ...) -> None: ... def clear(self) -> None: ... async def aclear(self) -> None: ... - def incr_version(self, key: Any, delta: int = ..., version: Any | None = ...) -> int: ... - async def aincr_version(self, key: Any, delta: int = ..., version: Any | None = ...) -> int: ... - def decr_version(self, key: Any, delta: int = ..., version: Any | None = ...) -> int: ... - async def adecr_version(self, key: Any, delta: int = ..., version: Any | None = ...) -> int: ... def close(self, **kwargs: Any) -> None: ... async def aclose(self, **kwargs: Any) -> None: ... diff --git a/scripts/stubtest/allowlist.txt b/scripts/stubtest/allowlist.txt index ef6a09219..e492c92db 100644 --- a/scripts/stubtest/allowlist.txt +++ b/scripts/stubtest/allowlist.txt @@ -411,3 +411,9 @@ django.contrib.sessions.base_session.AbstractBaseSession.Meta # Custom __str__ that we don't want to overcomplicate: django.forms.utils.RenderableMixin.__str__ django.forms.utils.RenderableMixin.__html__ + +# sentry: we remove these methods because they are unsafe for our usage +django.core.cache.backends.base.BaseCache.adecr_version +django.core.cache.backends.base.BaseCache.aincr_version +django.core.cache.backends.base.BaseCache.decr_version +django.core.cache.backends.base.BaseCache.incr_version