Browse Source

Merge topic 'ConvertMSBuildXMLToJSON-default-mutable'

98e735903a MSBuild: Fix python mutable default data structure

Acked-by: Kitware Robot <[email protected]>
Acked-by: Drew Dennison <[email protected]>
Merge-request: !4432
Brad King 5 years ago
parent
commit
41162cbb81
1 changed files with 7 additions and 2 deletions
  1. 7 2
      Source/cmConvertMSBuildXMLToJSON.py

+ 7 - 2
Source/cmConvertMSBuildXMLToJSON.py

@@ -35,12 +35,14 @@ def vsflags(*args):
     return values
 
 
-def read_msbuild_xml(path, values={}):
+def read_msbuild_xml(path, values=None):
     """Reads the MS Build XML file at the path and returns its contents.
 
     Keyword arguments:
     values -- The map to append the contents to (default {})
     """
+    if values is None:
+        values = {}
 
     # Attempt to read the file contents
     try:
@@ -76,12 +78,15 @@ def read_msbuild_xml(path, values={}):
     return values
 
 
-def read_msbuild_json(path, values=[]):
+def read_msbuild_json(path, values=None):
     """Reads the MS Build JSON file at the path and returns its contents.
 
     Keyword arguments:
     values -- The list to append the contents to (default [])
     """
+    if values is None:
+        values = []
+
     if not os.path.exists(path):
         logging.info('Could not find MS Build JSON file at %s', path)
         return values