diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-02-20 09:32:08 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-02-20 09:32:29 +0000 |
commit | 014c400849f01582f958e1a729ce239ffd7b2268 (patch) | |
tree | e30eac025e81b68a50ad7d167270bda28ee3ce21 /iredis/utils.py | |
parent | Releasing debian version 1.14.0-1. (diff) | |
download | iredis-014c400849f01582f958e1a729ce239ffd7b2268.tar.xz iredis-014c400849f01582f958e1a729ce239ffd7b2268.zip |
Merging upstream version 1.14.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'iredis/utils.py')
-rw-r--r-- | iredis/utils.py | 13 |
1 files changed, 7 insertions, 6 deletions
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: |