Fixed #27235 -- Removed some usage of mutable default arguments.

This commit is contained in:
Chris Lamb 2016-09-16 10:14:15 +01:00 committed by Tim Graham
parent 22e303887b
commit 9027e6c8a3
3 changed files with 4 additions and 4 deletions

View File

@ -94,7 +94,7 @@ class BaseDatabaseSchemaEditor(object):
# Core utility functions
def execute(self, sql, params=[]):
def execute(self, sql, params=()):
"""
Executes the given SQL statement, with optional parameters.
"""

View File

@ -142,7 +142,7 @@ class Field(RegisterLookupMixin):
db_index=False, rel=None, default=NOT_PROVIDED, editable=True,
serialize=True, unique_for_date=None, unique_for_month=None,
unique_for_year=None, choices=None, help_text='', db_column=None,
db_tablespace=None, auto_created=False, validators=[],
db_tablespace=None, auto_created=False, validators=(),
error_messages=None):
self.name = name
self.verbose_name = verbose_name # May be set by set_attributes_from_name
@ -175,7 +175,7 @@ class Field(RegisterLookupMixin):
self.creation_counter = Field.creation_counter
Field.creation_counter += 1
self._validators = validators # Store for deconstruction later
self._validators = list(validators) # Store for deconstruction later
messages = {}
for c in reversed(self.__class__.__mro__):

View File

@ -62,7 +62,7 @@ class Field(object):
def __init__(self, required=True, widget=None, label=None, initial=None,
help_text='', error_messages=None, show_hidden_initial=False,
validators=[], localize=False, disabled=False, label_suffix=None):
validators=(), localize=False, disabled=False, label_suffix=None):
# required -- Boolean that specifies whether the field is required.
# True by default.
# widget -- A Widget class, or instance of a Widget class, that should