summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrendon Go <brendon.go@gmail.com>2020-03-06 01:42:46 (GMT)
committerBrendon Go <brendon.go@gmail.com>2020-03-06 01:42:46 (GMT)
commit98e735903a031d0285389171c7f049bfe3e26286 (patch)
treef36369d8a54edf4aa170bc450d42661fa22f2b2f /Source
parente484b4289d41ff6f72aa84cdce638ea1f071a8af (diff)
downloadCMake-98e735903a031d0285389171c7f049bfe3e26286.zip
CMake-98e735903a031d0285389171c7f049bfe3e26286.tar.gz
CMake-98e735903a031d0285389171c7f049bfe3e26286.tar.bz2
MSBuild: Fix python mutable default data structure
Change default value of arguments to be None and instantiate new object inside function.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmConvertMSBuildXMLToJSON.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Source/cmConvertMSBuildXMLToJSON.py b/Source/cmConvertMSBuildXMLToJSON.py
index 02074ba..2be3781 100644
--- a/Source/cmConvertMSBuildXMLToJSON.py
+++ b/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