From 014c400849f01582f958e1a729ce239ffd7b2268 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 20 Feb 2024 10:32:08 +0100 Subject: Merging upstream version 1.14.1. Signed-off-by: Daniel Baumann --- iredis/utils.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'iredis/utils.py') diff --git a/iredis/utils.py b/iredis/utils.py index 5a61425..aa00533 100644 --- a/iredis/utils.py +++ b/iredis/utils.py @@ -39,10 +39,11 @@ def literal_bytes(b): return b -def _valid_token(words): - token = "".join(words).strip() - if token: - yield token +def nappend(word, c, pre_back_slash): + if pre_back_slash and c == "n": # \n + word[-1] = "\n" + else: + word.append(c) def strip_quote_args(s): @@ -69,7 +70,7 @@ def strip_quote_args(s): # previous char is \ , merge with current " word[-1] = char else: - word.append(char) + nappend(word, char, pre_back_slash) # not in quote else: # separator @@ -81,7 +82,7 @@ def strip_quote_args(s): elif char in ["'", '"']: in_quote = char else: - word.append(char) + nappend(word, char, pre_back_slash) if char == "\\" and not pre_back_slash: pre_back_slash = True else: -- cgit v1.2.3