importpkg.py + readyaml.py: prefer the C libyaml implementation
authorHelmut Grohne <helmut@subdivi.de>
Fri, 31 Dec 2021 21:43:29 +0000 (22:43 +0100)
committerHelmut Grohne <helmut@subdivi.de>
Fri, 31 Dec 2021 21:43:29 +0000 (22:43 +0100)
importpkg.py
readyaml.py

index 7bca70b..4f00407 100755 (executable)
@@ -79,7 +79,7 @@ def main():
                         type=urllib.request.urlopen,
                         help="read from this location instead of stdin")
     args = parser.parse_args()
-    dumper = yaml.SafeDumper(sys.stdout)
+    dumper = yaml.CSafeDumper(sys.stdout)
     dumper.open()
     if args.hash:
         args.input = HashedStream(args.input, hashlib.sha256())
index a4837cf..b88d1e0 100755 (executable)
@@ -12,7 +12,7 @@ import yaml
 def readyaml(db, stream):
     cur = db.cursor()
     cur.execute("PRAGMA foreign_keys = ON;")
-    gen = yaml.safe_load_all(stream)
+    gen = yaml.load_all(stream, yaml.CSafeLoader)
     metadata = next(gen)
     package = metadata["package"]
     cur.execute("SELECT id, version FROM package WHERE name = ?;",