Skip to content

Commit

Permalink
ref: remove incr_version / decr_version
Browse files Browse the repository at this point in the history
these methods are unsafe with our usage of cache
  • Loading branch information
asottile-sentry committed Jun 14, 2024
1 parent dde0f3c commit ed871b3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 0 additions & 4 deletions django-stubs/core/cache/backends/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...

Expand Down
6 changes: 6 additions & 0 deletions scripts/stubtest/allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ed871b3

Please sign in to comment.