Skip to content

Commit

Permalink
Merge pull request #304 from MVrachev/fix-default-arg-value
Browse files Browse the repository at this point in the history
Fix empty list as a default value for function arg
  • Loading branch information
lukpueh authored Nov 20, 2020
2 parents b6a4809 + bf53fd6 commit bbf1505
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions securesystemslib/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -878,19 +878,22 @@ class Struct(Schema):
False
"""

def __init__(self, sub_schemas, optional_schemas=[], allow_more=False,
def __init__(self, sub_schemas, optional_schemas=None, allow_more=False,
struct_name='list'):
"""
<Purpose>
Create a new Struct schema.
<Arguments>
sub_schemas: The sub-schemas recognized.
optional_schemas: The optional list of schemas.
optional_schemas: Optional list. If none is given, it will be "[]".
allow_more: Specifies that an optional list of types is allowed.
struct_name: A string identifier for the Struct object.
"""

if optional_schemas is None:
optional_schemas = []

# Ensure each item of the list contains the expected object type.
if not isinstance(sub_schemas, (list, tuple)):
raise securesystemslib.exceptions.FormatError(
Expand Down

0 comments on commit bbf1505

Please sign in to comment.