summaryrefslogtreecommitdiff
path: root/emitter.py
diff options
context:
space:
mode:
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: