]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-118827: Remove `Quoter` from `urllib.parse` (#118828)
authorNikita Sobolev <mail@sobolevn.me>
Mon, 3 Jun 2024 07:50:29 +0000 (10:50 +0300)
committerGitHub <noreply@github.com>
Mon, 3 Jun 2024 07:50:29 +0000 (10:50 +0300)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Doc/whatsnew/3.14.rst
Lib/test/test_urlparse.py
Lib/urllib/parse.py
Misc/NEWS.d/next/Library/2024-05-09-12-33-25.gh-issue-118827.JrzHz1.rst [new file with mode: 0644]

index 9f471d24909215296f51b928f2a38707bdc7e324..47f3e30942397f7ced18af3304e1d9c9b9859ffd 100644 (file)
@@ -218,6 +218,13 @@ typing
 * Remove :class:`!typing.ByteString`. It had previously raised a
   :exc:`DeprecationWarning` since Python 3.12.
 
+urllib
+------
+
+* Remove deprecated :class:`!Quoter` class from :mod:`urllib.parse`.
+  It had previously raised a :exc:`DeprecationWarning` since Python 3.11.
+  (Contributed by Nikita Sobolev in :gh:`118827`.)
+
 Others
 ------
 
index 4faad733245df97906afe0f9e371c7893a100bb0..d6c83a75c1c03a1f238ca5b512b4d8c59e826560 100644 (file)
@@ -1507,13 +1507,6 @@ class Utility_Tests(unittest.TestCase):
 
 
 class DeprecationTest(unittest.TestCase):
-
-    def test_Quoter_deprecation(self):
-        with self.assertWarns(DeprecationWarning) as cm:
-            old_class = urllib.parse.Quoter
-            self.assertIs(old_class, urllib.parse._Quoter)
-        self.assertIn('Quoter will be removed', str(cm.warning))
-
     def test_splittype_deprecation(self):
         with self.assertWarns(DeprecationWarning) as cm:
             urllib.parse.splittype('')
index 3932bb99c7e7d1bf1e3097f24e0b3e115e1f7cce..8f724f907d42173549225e762647376d41a54467 100644 (file)
@@ -822,14 +822,6 @@ _ALWAYS_SAFE = frozenset(b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
                          b'_.-~')
 _ALWAYS_SAFE_BYTES = bytes(_ALWAYS_SAFE)
 
-def __getattr__(name):
-    if name == 'Quoter':
-        warnings.warn('Deprecated in 3.11. '
-                      'urllib.parse.Quoter will be removed in Python 3.14. '
-                      'It was not intended to be a public API.',
-                      DeprecationWarning, stacklevel=2)
-        return _Quoter
-    raise AttributeError(f'module {__name__!r} has no attribute {name!r}')
 
 class _Quoter(dict):
     """A mapping from bytes numbers (in range(0,256)) to strings.
diff --git a/Misc/NEWS.d/next/Library/2024-05-09-12-33-25.gh-issue-118827.JrzHz1.rst b/Misc/NEWS.d/next/Library/2024-05-09-12-33-25.gh-issue-118827.JrzHz1.rst
new file mode 100644 (file)
index 0000000..40612dd
--- /dev/null
@@ -0,0 +1,3 @@
+Remove deprecated :class:`!Quoter` class from :mod:`urllib.parse`. It had
+previously raised a :exc:`DeprecationWarning` since Python 3.11.
+Patch by Nikita Sobolev.