]> xenbits.xensource.com Git - libvirt.git/commitdiff
cputest: Move instantiation of JSONDecoder in cpu-convert.py
authorJiri Denemark <jdenemar@redhat.com>
Wed, 15 Mar 2017 12:09:21 +0000 (13:09 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 27 Mar 2017 14:29:27 +0000 (16:29 +0200)
Let's make the object local to the parseFeatureWords function which uses
it.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
tests/cputestdata/cpu-convert.py

index 898d42f107b4b121336ac115dc246e82ba59f030..e069408c8cf698307c4a6f71605ecd262d69b739 100755 (executable)
@@ -174,6 +174,8 @@ cpuidMap = [
 def parseFeatureWords(path):
     features = None
 
+    dec = json.JSONDecoder()
+
     with open(path, "r") as f:
         s = f.read()
 
@@ -220,8 +222,6 @@ def propAdd(props, feature, value):
         props[name] = value
 
 
-dec = json.JSONDecoder()
-
 for path in sys.argv[1:]:
     props, cpuid = parseFeatureWords(path)