Skip to content

Commit 2f7cba2

Browse files
committed
[ModelicaSystem] fix default argument - PyCharm: default argument value is mutable
1 parent da84dba commit 2f7cba2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

OMPython/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ class ModelicaSystemError(Exception):
793793

794794

795795
class ModelicaSystem(object):
796-
def __init__(self, fileName=None, modelName=None, lmodel=[], useCorba=False, commandLineOptions=None,
796+
def __init__(self, fileName=None, modelName=None, lmodel=None, useCorba=False, commandLineOptions=None,
797797
variableFilter=None, customBuildDirectory=None, verbose=True, raiseerrors=False): # 1
798798
"""
799799
"constructor"
@@ -841,6 +841,9 @@ def __init__(self, fileName=None, modelName=None, lmodel=[], useCorba=False, com
841841
## set commandLineOptions if provided by users
842842
self.setCommandLineOptions(commandLineOptions=commandLineOptions)
843843

844+
if lmodel is None:
845+
lmodel = []
846+
844847
self.xmlFile = None
845848
self.lmodel = lmodel # may be needed if model is derived from other model
846849
self.modelName = modelName # Model class name

0 commit comments

Comments
 (0)