gh-118827: Remove `Quoter` from `urllib.parse` (#118828)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
This commit is contained in:
Nikita Sobolev 2024-06-03 10:50:29 +03:00 committed by GitHub
parent 52586f930f
commit 84c3191954
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 15 deletions

View 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
------

View 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('')

View 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.

View File

@ -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.