Skip to content

Commit 6242fa5

Browse files
committed
use fresh YAML instance for _render_yaml_value
Signed-off-by: Taeseung Sohn <taeseung.sohn@tier4.jp>
1 parent 869e41b commit 6242fa5

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

.github/scripts/sync_params.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,12 +363,16 @@ def _render_inline_yaml_value(value: Any) -> str:
363363
def _render_yaml_value(value: Any) -> str:
364364
"""Render *value* as YAML, preserving its natural round-trip style.
365365
366+
Uses a fresh YAML instance to avoid mutating the global ``_YAML_RT`` state.
367+
366368
Example:
367369
value = 42
368370
returns "42"
369371
"""
372+
y = YAML()
373+
y.default_flow_style = None
370374
stream = io.StringIO()
371-
_YAML_RT.dump(value, stream)
375+
y.dump(value, stream)
372376
# ruamel appends "\n...\n" (YAML document-end marker) when dumping bare scalars;
373377
# strip it so the output stays on a single line for scalar values.
374378
return stream.getvalue().rstrip("\n").removesuffix("\n...")

0 commit comments

Comments
 (0)