From: Marc Abramowitz Date: Wed, 28 May 2014 15:54:28 +0000 (-0700) Subject: Eliminate {} (dict) default arg value for `opts` X-Git-Tag: rel_0_6_6~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0a93da93d011118d9446e0ef7b4d5d80e550adfb;p=thirdparty%2Fsqlalchemy%2Falembic.git Eliminate {} (dict) default arg value for `opts` to MigrationContext.configure Using a mutable type as a default value is a common source of obscure problems. See http://docs.python-guide.org/en/latest/writing/gotchas/#mutable-default-arguments --- diff --git a/alembic/migration.py b/alembic/migration.py index e5de70f3..dadf49ab 100644 --- a/alembic/migration.py +++ b/alembic/migration.py @@ -117,7 +117,7 @@ class MigrationContext(object): url=None, dialect_name=None, environment_context=None, - opts={}, + opts=None, ): """Create a new :class:`.MigrationContext`. @@ -139,6 +139,9 @@ class MigrationContext(object): this dictionary. """ + if opts is None: + opts = {} + if connection: dialect = connection.dialect elif url: