Skip to content

Commit

Permalink
Fix "play build-module" by replacing instances of yaml.load with yaml…
Browse files Browse the repository at this point in the history
….safe_load

This fixes an error when "play build-module" is run on Python 3.7.11:
  load() missing 1 required positional argument: 'Loader'

This follows the recommendation shown on
  https://github.com/yaml/pyyaml/wiki/PyYAML-yaml.load(input)-Deprecation

A loader argument is now required.  This commit assumes that
dependencies.yml uses standard YAML tags, and so uses safe_loader,
which is the most secure loader.
  • Loading branch information
David Costanzo committed Jan 30, 2024
1 parent f832ef8 commit 3a52717
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions framework/pym/play/commands/modulesrepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def build(app, args, env):
if os.path.exists(deps_file):
f = open(deps_file)
try:
deps = yaml.load(f.read())
deps = yaml.safe_load(f.read())
if 'self' in deps:
splitted = deps["self"].split(" -> ")
if len(splitted) == 2:
Expand All @@ -346,7 +346,7 @@ def build(app, args, env):

if os.path.exists(deps_file):
f = open(deps_file)
deps = yaml.load(f.read())
deps = yaml.safe_load(f.read())
if 'self' in deps:
splitted = deps["self"].split(" -> ")
f.close()
Expand Down

0 comments on commit 3a52717

Please sign in to comment.