Skip to content

Commit cea2cf6

Browse files
committed
Don't re-use YAML object
This builds on #56 so that the file-global `yaml` is never re-used. Without this small change, technically you could load a file, have an exception, and have issues loading future files.
1 parent bf4c27f commit cea2cf6

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

srsly/_yaml_api.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ def dump(self, data, stream=None, **kw):
2525
return stream.getvalue()
2626

2727

28-
yaml = CustomYaml()
29-
30-
3128
def yaml_dumps(
3229
data: YAMLInput,
3330
indent_mapping: int = 2,
@@ -58,6 +55,7 @@ def yaml_loads(data: Union[str, IO]) -> YAMLOutput:
5855
data (str / file): The data to deserialize.
5956
RETURNS: The deserialized Python object.
6057
"""
58+
yaml = CustomYaml()
6159
try:
6260
return yaml.load(data)
6361
except Exception as e:

0 commit comments

Comments
 (0)