From 67d9d159adfaf182dc65d7553c0837483d69efa0 Mon Sep 17 00:00:00 2001 From: Anthon van der Neut Date: Tue, 9 May 2023 22:00:30 +0200 Subject: edge case for 459 --- CHANGES | 3 +++ README.rst | 5 ++++- __init__.py | 6 +++--- _doc/_static/pypi.svg | 2 +- emitter.py | 4 ++-- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CHANGES b/CHANGES index 6398bcc..d8e0085 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +[0, 17, 26]: 2023-05-09 + - Fix for error on edge cage for issue 459 + [0, 17, 25]: 2023-05-09 - fix for regression while dumping wrapped strings with too many backslashes removed (issue 459, reported by `Lele Gaifax `__) diff --git a/README.rst b/README.rst index 81631c7..2cb1c12 100644 --- a/README.rst +++ b/README.rst @@ -4,7 +4,7 @@ ruamel.yaml ``ruamel.yaml`` is a YAML 1.2 loader/dumper package for Python. -:version: 0.17.25 +:version: 0.17.26 :updated: 2023-05-09 :documentation: http://yaml.readthedocs.io :repository: https://sourceforge.net/projects/ruamel-yaml/ @@ -61,6 +61,9 @@ ChangeLog .. should insert NEXT: at the beginning of line for next key (with empty line) +0.17.26 (2023-05-09): + - Fix for error on edge cage for issue 459 + 0.17.25 (2023-05-09): - fix for regression while dumping wrapped strings with too many backslashes removed (issue 459, reported by `Lele Gaifax `__) diff --git a/__init__.py b/__init__.py index c676d16..210337f 100644 --- a/__init__.py +++ b/__init__.py @@ -5,9 +5,9 @@ if False: # MYPY _package_data = dict( full_package_name='ruamel.yaml', - version_info=(0, 17, 25), - __version__='0.17.25', - version_timestamp='2023-05-09 19:56:50', + version_info=(0, 17, 26), + __version__='0.17.26', + version_timestamp='2023-05-09 21:59:45', author='Anthon van der Neut', author_email='a.van.der.neut@ruamel.eu', description='ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order', # NOQA diff --git a/_doc/_static/pypi.svg b/_doc/_static/pypi.svg index b5c8870..0790f1e 100644 --- a/_doc/_static/pypi.svg +++ b/_doc/_static/pypi.svg @@ -1 +1 @@ - pypipypi0.17.250.17.25 + pypipypi0.17.260.17.26 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: -- cgit v1.2.1