[libc-commits] [libc] [libc] move newheadergen back to safe_load (PR #105374)

via libc-commits libc-commits at lists.llvm.org
Tue Aug 20 14:02:12 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Michael Jones (michaelrj-google)

<details>
<summary>Changes</summary>

In #<!-- -->100024 we moved from safe_load to load for reading the yaml in
newheadergen due to dependency issues. Those should be resolved by now
so this should be a simple safety improvement.


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


1 Files Affected:

- (modified) libc/newhdrgen/yaml_to_classes.py (+2-2) 


``````````diff
diff --git a/libc/newhdrgen/yaml_to_classes.py b/libc/newhdrgen/yaml_to_classes.py
index 3eb5e4ef2546c1..237dd21aa5dff5 100644
--- a/libc/newhdrgen/yaml_to_classes.py
+++ b/libc/newhdrgen/yaml_to_classes.py
@@ -118,7 +118,7 @@ def load_yaml_file(yaml_file, header_class, entry_points):
         HeaderFile: An instance of HeaderFile populated with the data.
     """
     with open(yaml_file, "r") as f:
-        yaml_data = yaml.load(f, Loader=yaml.FullLoader)
+        yaml_data = yaml.safe_load(f)
     return yaml_to_classes(yaml_data, header_class, entry_points)
 
 
@@ -173,7 +173,7 @@ def add_function_to_yaml(yaml_file, function_details):
     new_function = parse_function_details(function_details)
 
     with open(yaml_file, "r") as f:
-        yaml_data = yaml.load(f, Loader=yaml.FullLoader)
+        yaml_data = yaml.safe_load(f)
     if "functions" not in yaml_data:
         yaml_data["functions"] = []
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/105374


More information about the libc-commits mailing list