summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2021-10-01 13:18:41 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2021-10-01 13:25:16 -0400
commit7f7c0f4ee1c4218fb72dccb7c5176042902c803a (patch)
tree3c097a3fdddd9228c9cc72a488f3420c418d385d /lib/sqlalchemy/engine
parentab6605aee23ed2c70c38bd5b9f50a6395ac3f2e1 (diff)
downloadsqlalchemy-7f7c0f4ee1c4218fb72dccb7c5176042902c803a.tar.gz
indicate private use of URL.__new__ privately only
Fixed issue where the deprecation warning for the :class:`.URL` constructor which indicates that the :meth:`.URL.create` method should be used would not emit if a full positional argument list of seven arguments were passed; additionally, validation of URL arguments will now occur if the constructor is called in this way, which was being skipped previously. Fixes: #7130 Change-Id: I8c8491d8aa7774afaf67c22b4f8e9859f780f2d9
Diffstat (limited to 'lib/sqlalchemy/engine')
-rw-r--r--lib/sqlalchemy/engine/url.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/sqlalchemy/engine/url.py b/lib/sqlalchemy/engine/url.py
index d91f06011..488f73952 100644
--- a/lib/sqlalchemy/engine/url.py
+++ b/lib/sqlalchemy/engine/url.py
@@ -85,7 +85,7 @@ class URL(
"""
def __new__(self, *arg, **kw):
- if not kw and len(arg) == 7:
+ if kw.pop("_new_ok", False):
return super(URL, self).__new__(self, *arg, **kw)
else:
util.warn_deprecated(
@@ -151,6 +151,7 @@ class URL(
cls._assert_port(port),
cls._assert_none_str(database, "database"),
cls._str_dict(query),
+ _new_ok=True,
)
@classmethod
@@ -466,6 +467,7 @@ class URL(
for key in set(self.query).difference(names)
}
),
+ _new_ok=True,
)
@util.memoized_property