Changes between Initial Version and Version 1 of Ticket #33361


Ignore:
Timestamp:
Dec 13, 2021, 12:04:51 AM (3 years ago)
Author:
Mariusz Felisiak
Comment:

Thanks for report! It should be enough to special-case bool, e.g.

  • django/core/cache/backends/redis.py

    diff --git a/django/core/cache/backends/redis.py b/django/core/cache/backends/redis.py
    index 16556b1ded..bbb0e0320d 100644
    a b from django.utils.module_loading import import_string  
    1111
    1212class RedisSerializer(PickleSerializer):
    1313    def dumps(self, obj):
    14         if isinstance(obj, int):
     14        if isinstance(obj, int) and not isinstance(obj, bool):
    1515            return obj
    1616        return super().dumps(obj)
    1717

Would you like to prepare a patch?

What was the rationale behind the int special-case? django-redis for instance consistently sends all data through pickle.

We do this to have better atomicity of incr() and decr() operations (see discussion).

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #33361

    • Property Cc Nick Pope Daniyal Abbasi added
    • Property Severity NormalRelease blocker
    • Property Triage Stage UnreviewedAccepted
  • Ticket #33361 – Description

    initial v1  
    1313
    1414What was the rationale behind the `int` special-case? `django-redis` for instance consistently sends all data through pickle.
    15 
Back to Top