Use yaml.safe_load as we are just using basic data structures

This commit is contained in:
Michael DeHaan 2013-02-23 13:30:10 -05:00
parent 7650d7c20e
commit a9ea3136cf

View file

@ -237,7 +237,7 @@ def parse_json(raw_data):
def parse_yaml(data): def parse_yaml(data):
''' convert a yaml string to a data structure ''' ''' convert a yaml string to a data structure '''
return yaml.load(data) return yaml.safe_load(data)
def process_yaml_error(exc, data, path=None): def process_yaml_error(exc, data, path=None):
if hasattr(exc, 'problem_mark'): if hasattr(exc, 'problem_mark'):
@ -345,7 +345,7 @@ def _gitinfo():
# Check if the .git is a file. If it is a file, it means that we are in a submodule structure. # Check if the .git is a file. If it is a file, it means that we are in a submodule structure.
if os.path.isfile(repo_path): if os.path.isfile(repo_path):
try: try:
gitdir = yaml.load(open(repo_path)).get('gitdir') gitdir = yaml.safe_load(open(repo_path)).get('gitdir')
# There is a posibility the .git file to have an absolute path. # There is a posibility the .git file to have an absolute path.
if os.path.isabs(gitdir): if os.path.isabs(gitdir):
repo_path = gitdir repo_path = gitdir