Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Ravi - feature/DOPCTAR-12927 - move date encoding before str encoding
  • Loading branch information
Ravi Kiran Adusumalli authored and Ravi Kiran Adusumalli committed May 21, 2025
commit 2a58ccdf79b41021b8587f6b6b4e52de943a7c3d
4 changes: 2 additions & 2 deletions redis/_parsers/encoders.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ def encode(self, value):
)
elif isinstance(value, (int, float)):
value = repr(value).encode()
elif isinstance(value, date):
value = str(value).encode(self.encoding, self.encoding_errors)
elif not isinstance(value, str):
# a value we don't know how to deal with. throw an error
typename = type(value).__name__
raise DataError(
f"Invalid input of type: '{typename}'. "
f"Convert to a bytes, string, int or float first."
)
elif isinstance(value, date):
value = str(value).encode(self.encoding, self.encoding_errors)
if isinstance(value, str):
value = value.encode(self.encoding, self.encoding_errors)

Expand Down