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

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


Author: Michael Jones
Date: 2024-08-20T14:22:10-07:00
New Revision: a3c66c8f35df9d231761385e2986c54e824d39fa

URL: https://github.com/llvm/llvm-project/commit/a3c66c8f35df9d231761385e2986c54e824d39fa
DIFF: https://github.com/llvm/llvm-project/commit/a3c66c8f35df9d231761385e2986c54e824d39fa.diff

LOG: [libc] move newheadergen back to safe_load (#105374)

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.

Added: 
    

Modified: 
    libc/newhdrgen/yaml_to_classes.py

Removed: 
    


################################################################################
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"] = []
 


        


More information about the libc-commits mailing list