28 lines
1.1 KiB
Diff
28 lines
1.1 KiB
Diff
|
From 8db1b02b8649540b0d649bb884ca1ad9a9937677 Mon Sep 17 00:00:00 2001
|
||
|
From: Ben Greiner <code@bnavigator.de>
|
||
|
Date: Sun, 9 Oct 2022 21:35:45 +0200
|
||
|
Subject: [PATCH] Fix ensure_str
|
||
|
|
||
|
---
|
||
|
fakeredis/_fakesocket.py | 6 +++---
|
||
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
||
|
|
||
|
diff --git a/fakeredis/_fakesocket.py b/fakeredis/_fakesocket.py
|
||
|
index 71cc5e3..4452d32 100644
|
||
|
--- a/fakeredis/_fakesocket.py
|
||
|
+++ b/fakeredis/_fakesocket.py
|
||
|
@@ -1517,10 +1517,10 @@ def _convert_lua_result(self, result, nested=True):
|
||
|
return 1 if result else None
|
||
|
return result
|
||
|
|
||
|
- def ensure_str(self, s):
|
||
|
- return (s.decode(encoding='utf-8', errors='replace')
|
||
|
+ def ensure_str(self, s, encoding, replaceerr):
|
||
|
+ return (s.decode(encoding=encoding, errors=replaceerr)
|
||
|
if isinstance(s, bytes)
|
||
|
- else str(s).encode(encoding='utf-8', errors='replace'))
|
||
|
+ else str(s).encode(encoding=encoding, errors=replaceerr))
|
||
|
|
||
|
def _check_for_lua_globals(self, lua_runtime, expected_globals):
|
||
|
actual_globals = set(lua_runtime.globals().keys())
|