Skip to content

Commit

Permalink
test pyyaml_4.2 (#4285)
Browse files Browse the repository at this point in the history
* lets test pyyaml_4.2

* keep version, use safe_load
  • Loading branch information
memsharded authored and lasote committed Jan 17, 2019
1 parent b27adca commit af32291
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions conans/model/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ def __init__(self, values=None):
tokens = k.split(":")
if len(tokens) == 2:
package, option = tokens
package_values = self._reqs_options.setdefault(package.strip(), PackageOptionValues())
package_values = self._reqs_options.setdefault(package.strip(),
PackageOptionValues())
package_values.add_option(option, v)
else:
self._package_values.add_option(k, v)
Expand Down Expand Up @@ -367,7 +368,7 @@ def __contains__(self, option):

@staticmethod
def loads(text):
return PackageOptions(yaml.load(text) or {})
return PackageOptions(yaml.safe_load(text) or {})

def get_safe(self, field):
return self._data.get(field)
Expand Down Expand Up @@ -461,7 +462,8 @@ def propagate_upstream(self, package_values, down_ref, own_ref, pattern_options)
modified_value, modified_ref = modified
raise ConanException("%s tried to change %s option %s to %s\n"
"but it was already assigned to %s by %s"
% (down_ref, own_ref, name, value, modified_value, modified_ref))
% (down_ref, own_ref, name, value,
modified_value, modified_ref))
else:
if name in pattern_options: # If it is a pattern-matched option, should check field
if name in self._data:
Expand Down
2 changes: 1 addition & 1 deletion conans/model/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def copy_values(self):

@staticmethod
def loads(text):
return Settings(yaml.load(text) or {})
return Settings(yaml.safe_load(text) or {})

def validate(self):
for field in self.fields:
Expand Down
2 changes: 1 addition & 1 deletion conans/model/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def root(self):

def _loads(self, text):
try:
yml = yaml.load(text)
yml = yaml.safe_load(text)
self._generator = yml.pop("generator", None)
self._name = yml.pop("name", None)
self._root = [s.strip() for s in yml.pop("root", "").split(",") if s.strip()]
Expand Down

0 comments on commit af32291

Please sign in to comment.