Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "play build-module" by replacing yaml.load with yaml.safe_load #1472

Merged
merged 1 commit into from Mar 3, 2024

Conversation

davidcostanzo
Copy link
Contributor

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. This is the most secure loader.

Helpful things

Fixes

Fixes #1456

Purpose

This pull request fixes a bug where "play build-module" throws an error with Python 3.7.11

Traceback (most recent call last):
  File "/devel/dcostanz/github/play1_david_costanzo/play", line 168, in <module>
    status = cmdloader.commands[play_command].execute(command=play_command, app=play_app, args=remaining_args, env=play_env, cmdloader=cmdloader)
  File "/scharp/devel/dcostanz/github/play1_david_costanzo/framework/pym/play/commands/modulesrepo.py", line 73, in execute
    build(app, args, env)
  File "/scharp/devel/dcostanz/github/play1_david_costanzo/framework/pym/play/commands/modulesrepo.py", line 331, in build
    deps = yaml.load(f.read())

With Python 3.10.12, it's merely a warning

~ calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.

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.
This is the most secure loader.
@xael-fry xael-fry added the defect label Mar 3, 2024
@xael-fry xael-fry self-requested a review March 3, 2024 08:18
@xael-fry xael-fry added this to the 1.9.0 milestone Mar 3, 2024
@xael-fry xael-fry merged commit e0916dd into playframework:master Mar 3, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Play build-module fails
2 participants