]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Avoid mutable object as default values
authortsimafeip <tsimafei.prakapenka@gmail.com>
Tue, 24 Aug 2021 19:29:51 +0000 (15:29 -0400)
committerFederico Caselli <cfederico87@gmail.com>
Tue, 24 Aug 2021 20:08:11 +0000 (22:08 +0200)
Fixes: #6915
Closes: #6916
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6916
Pull-request-sha: 6ec484d3d14b7dd7053d10a5d550bd74eb524c8b

Change-Id: I2c87fbed44870110e35a69ee9a9e678671eeb8f0

lib/sqlalchemy/engine/url.py
lib/sqlalchemy/sql/ddl.py
lib/sqlalchemy/util/compat.py

index d72654c73332dfe6d563c89b2e16b9f5363a8619..b924f1c7303e2bee9ffc8c1fa47d092abad91f5b 100644 (file)
@@ -655,7 +655,7 @@ class URL(
         dialect_cls = entrypoint.get_dialect_cls(self)
         return dialect_cls
 
-    def translate_connect_args(self, names=[], **kw):
+    def translate_connect_args(self, names=None, **kw):
         r"""Translate url attributes into a dictionary of connection arguments.
 
         Returns attributes of this url (`host`, `database`, `username`,
index 233e79f7c5012fcd3aedf3e06626e05ea67951b3..f8985548ee04896a02c13615e430bb28994d6c6f 100644 (file)
@@ -1081,7 +1081,7 @@ class SchemaDropper(DDLBase):
         table,
         drop_ok=False,
         _is_metadata_operation=False,
-        _ignore_sequences=[],
+        _ignore_sequences=(),
     ):
         if not drop_ok and not self._can_drop_table(table):
             return
index 5d52f740fcbf26adfd9aa78986432e204fb9cdb3..5914e8681aad2e5e7e741e95f5b20aecfb24c1af 100644 (file)
@@ -392,6 +392,9 @@ if py3k:
 
         """
 
+        kwonlydefaults = kwonlydefaults or {}
+        annotations = annotations or {}
+
         def formatargandannotation(arg):
             result = formatarg(arg)
             if arg in annotations: