Skip to content

Commit 67b2fcc

Browse files
sobolevnhauntsaninjahugovk
authored andcommitted
pythongh-118827: Remove Quoter from urllib.parse (python#118828)
Co-authored-by: Shantanu <[email protected]> Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent c9678a6 commit 67b2fcc

File tree

4 files changed

+10
-15
lines changed

4 files changed

+10
-15
lines changed

Doc/whatsnew/3.14.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,13 @@ typing
218218
* Remove :class:`!typing.ByteString`. It had previously raised a
219219
:exc:`DeprecationWarning` since Python 3.12.
220220

221+
urllib
222+
------
223+
224+
* Remove deprecated :class:`!Quoter` class from :mod:`urllib.parse`.
225+
It had previously raised a :exc:`DeprecationWarning` since Python 3.11.
226+
(Contributed by Nikita Sobolev in :gh:`118827`.)
227+
221228
Others
222229
------
223230

Lib/test/test_urlparse.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,13 +1507,6 @@ def test_unwrap(self):
15071507

15081508

15091509
class DeprecationTest(unittest.TestCase):
1510-
1511-
def test_Quoter_deprecation(self):
1512-
with self.assertWarns(DeprecationWarning) as cm:
1513-
old_class = urllib.parse.Quoter
1514-
self.assertIs(old_class, urllib.parse._Quoter)
1515-
self.assertIn('Quoter will be removed', str(cm.warning))
1516-
15171510
def test_splittype_deprecation(self):
15181511
with self.assertWarns(DeprecationWarning) as cm:
15191512
urllib.parse.splittype('')

Lib/urllib/parse.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -822,14 +822,6 @@ def unquote_plus(string, encoding='utf-8', errors='replace'):
822822
b'_.-~')
823823
_ALWAYS_SAFE_BYTES = bytes(_ALWAYS_SAFE)
824824

825-
def __getattr__(name):
826-
if name == 'Quoter':
827-
warnings.warn('Deprecated in 3.11. '
828-
'urllib.parse.Quoter will be removed in Python 3.14. '
829-
'It was not intended to be a public API.',
830-
DeprecationWarning, stacklevel=2)
831-
return _Quoter
832-
raise AttributeError(f'module {__name__!r} has no attribute {name!r}')
833825

834826
class _Quoter(dict):
835827
"""A mapping from bytes numbers (in range(0,256)) to strings.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Remove deprecated :class:`!Quoter` class from :mod:`urllib.parse`. It had
2+
previously raised a :exc:`DeprecationWarning` since Python 3.11.
3+
Patch by Nikita Sobolev.

0 commit comments

Comments
 (0)