Skip to content

[libc] Use yaml.safe_load rather than yaml.load #109557

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

Merged
merged 1 commit into from
Sep 22, 2024

Conversation

petrhosek
Copy link
Member

yaml.load is considered unsafe, use yaml.safe_load.

`yaml.load` is considered unsafe, use `yaml.safe_load`.
@llvmbot
Copy link
Member

llvmbot commented Sep 22, 2024

@llvm/pr-subscribers-libc

Author: Petr Hosek (petrhosek)

Changes

yaml.load is considered unsafe, use yaml.safe_load.


Full diff: https://github.com/llvm/llvm-project/pull/109557.diff

1 Files Affected:

  • (modified) libc/newhdrgen/yaml_functions_sorted.py (+1-1)
diff --git a/libc/newhdrgen/yaml_functions_sorted.py b/libc/newhdrgen/yaml_functions_sorted.py
index db19edf7481de2..b960ecaf973f52 100644
--- a/libc/newhdrgen/yaml_functions_sorted.py
+++ b/libc/newhdrgen/yaml_functions_sorted.py
@@ -6,7 +6,7 @@
 
 def sort_yaml_functions(yaml_file):
     with open(yaml_file, "r") as f:
-        yaml_data = yaml.load(f, Loader=yaml.FullLoader)
+        yaml_data = yaml.safe_load(f)
 
     if "functions" in yaml_data:
         yaml_data["functions"].sort(key=lambda x: x["name"])

@petrhosek petrhosek merged commit eaedbbc into llvm:main Sep 22, 2024
9 checks passed
@jhuber6
Copy link
Contributor

jhuber6 commented Sep 22, 2024

I thought we deliberately used yaml.load because it was available within the Python version required for LLVM? I guess we'll see if the NVPTX bot breaks because of this.

@petrhosek
Copy link
Member Author

We already switched to yaml.safe_load elsewhere in #105374 and haven't seen any breakages.

@jhuber6
Copy link
Contributor

jhuber6 commented Sep 22, 2024

Bot was fine with it, so no problems here. https://lab.llvm.org/buildbot/#/builders/69/builds/5888

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.

4 participants