mirror of
https://github.com/django/django.git
synced 2025-03-06 07:22:32 +00:00
[5.2.x] Clarified cryptic comment in django/core/cache/backends/redis.py.
Backport of 9a729fb61add16d89a4b42b491aec2d22f1ae69a from main.
This commit is contained in:
parent
d42b187022
commit
b179c67860
5
django/core/cache/backends/redis.py
vendored
5
django/core/cache/backends/redis.py
vendored
@ -14,8 +14,9 @@ class RedisSerializer:
|
|||||||
self.protocol = pickle.HIGHEST_PROTOCOL if protocol is None else protocol
|
self.protocol = pickle.HIGHEST_PROTOCOL if protocol is None else protocol
|
||||||
|
|
||||||
def dumps(self, obj):
|
def dumps(self, obj):
|
||||||
# Only skip pickling for integers, a int subclasses as bool should be
|
# For better incr() and decr() atomicity, don't pickle integers.
|
||||||
# pickled.
|
# Using type() rather than isinstance() matches only integers and not
|
||||||
|
# subclasses like bool.
|
||||||
if type(obj) is int:
|
if type(obj) is int:
|
||||||
return obj
|
return obj
|
||||||
return pickle.dumps(obj, self.protocol)
|
return pickle.dumps(obj, self.protocol)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user