Skip to content

Commit

Permalink
ref: remove incr_version / decr_version (#15)
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 Sep 24, 2024
1 parent a04fb96 commit b9fdc01
Show file tree
Hide file tree
Showing 2 changed files with 10 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) -> None: ...
def clear(self) -> None: ...
async def aclear(self) -> None: ...
def incr_version(self, key: Any, delta: int = 1, version: Any | None = None) -> int: ...
async def aincr_version(self, key: Any, delta: int = 1, version: Any | None = None) -> int: ...
def decr_version(self, key: Any, delta: int = 1, version: Any | None = None) -> int: ...
async def adecr_version(self, key: Any, delta: int = 1, version: Any | None = None) -> int: ...
def close(self, **kwargs: Any) -> None: ...
async def aclose(self, **kwargs: Any) -> None: ...

Expand Down
10 changes: 10 additions & 0 deletions scripts/stubtest/allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -478,3 +478,13 @@ django.contrib.auth.views.UserModel
# Using the definitions from `dict` (from typeshed)
django.contrib.sessions.backends.base.SessionBase.get
django.contrib.sessions.backends.base.SessionBase.setdefault

# sentry: we remove these methods because they are unsafe for our usage
django.core.cache.BaseCache.adecr_version
django.core.cache.BaseCache.aincr_version
django.core.cache.BaseCache.decr_version
django.core.cache.BaseCache.incr_version
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 b9fdc01

Please sign in to comment.