summaryrefslogtreecommitdiff
path: root/emitter.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2023-05-09 22:00:30 +0200
committerAnthon van der Neut <anthon@mnt.org>2023-05-09 22:00:30 +0200
commit67d9d159adfaf182dc65d7553c0837483d69efa0 (patch)
treec1c9a8044914e9eb98f33a01f4f8a3944fb5bf42 /emitter.py
parent4a04b2293b3bd3068a70bdfa61c2bdb175e614e0 (diff)
downloadruamel.yaml-67d9d159adfaf182dc65d7553c0837483d69efa0.tar.gz
edge case for 4590.17.26
Diffstat (limited to 'emitter.py')
-rw-r--r--emitter.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/emitter.py b/emitter.py
index d882fdc..94986fe 100644
--- a/emitter.py
+++ b/emitter.py
@@ -1402,8 +1402,8 @@ class Emitter:
# data = text[start:end] + u'\\' # <<< replaced with following six lines
need_backquote = True
if len(text) > end:
- space_pos = text.index(' ', end)
try:
+ space_pos = text.index(' ', end)
if (
'"' not in text[end:space_pos]
and "'" not in text[end:space_pos]
@@ -1411,7 +1411,7 @@ class Emitter:
and text[end - 1 : end + 1] != ' '
):
need_backquote = False
- except IndexError:
+ except (ValueError, IndexError):
pass
data = text[start:end] + ('\\' if need_backquote else '')
if start < end: