Skip to content

Commit 5c8a18f

Browse files
committed
gh-161970: Extend the maxsplit deprecation period to Python 3.21
1 parent 836df52 commit 5c8a18f

7 files changed

Lines changed: 14 additions & 14 deletions

File tree

‎Doc/deprecations/pending-removal-in-3.18.rst‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,6 @@ Pending removal in Python 3.18
44
* No longer accept a boolean value when a file descriptor is expected.
55
(Contributed by Serhiy Storchaka in :gh:`82626`.)
66

7-
* :mod:`collections`:
8-
9-
* The undocumented ``maxsplit`` keyword parameter of
10-
:meth:`!collections.UserString.replace` has been deprecated since
11-
Python 3.16. Pass the count as a positional argument or use the
12-
``count`` keyword parameter instead.
13-
147
* :mod:`decimal`:
158

169
* The non-standard and undocumented :class:`~decimal.Decimal` format

‎Doc/deprecations/pending-removal-in-3.21.rst‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ Pending removal in Python 3.21
1818
* The ``dims`` property of ``ast.Tuple`` will be removed in Python 3.21. Use
1919
the ``ast.Tuple.elts`` property instead.
2020

21+
* :mod:`collections`:
22+
23+
* The undocumented ``maxsplit`` keyword parameter of
24+
:meth:`!collections.UserString.replace` has been deprecated since
25+
Python 3.16. Pass the count as a positional argument or use the
26+
``count`` keyword parameter instead.
27+
2128
* :mod:`functools`:
2229

2330
* Using a return annotation to infer the dispatch type for

‎Doc/library/collections.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1439,7 +1439,7 @@ attribute.
14391439
New methods ``__getnewargs__``, ``__rmod__``, ``casefold``,
14401440
``format_map``, ``isprintable``, and ``maketrans``.
14411441

1442-
.. deprecated-removed:: 3.16 3.18
1442+
.. deprecated-removed:: 3.16 3.21
14431443
The third parameter of :meth:`!replace` is now named *count*, as in
14441444
:meth:`str.replace`, and the undocumented ``maxsplit`` keyword
14451445
parameter is deprecated. Prefer passing the count as a positional

‎Doc/whatsnew/3.16.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,7 @@ New deprecations
13341334
* The third parameter of :meth:`!collections.UserString.replace` is now
13351335
named *count*, as in :meth:`str.replace`. Support for the undocumented
13361336
``maxsplit`` keyword parameter is now deprecated and slated for removal
1337-
in Python 3.18. Prefer passing the count as a positional argument for
1337+
in Python 3.21. Prefer passing the count as a positional argument for
13381338
maximum backwards compatibility.
13391339
(Contributed by David Andrews in :gh:`161970`.)
13401340

‎Lib/collections/__init__.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,21 +1614,21 @@ def lstrip(self, chars=None):
16141614
def partition(self, sep):
16151615
return self.data.partition(sep)
16161616

1617-
# The 'maxsplit' keyword parameter can be removed in Python 3.18.
1617+
# The 'maxsplit' keyword parameter can be removed in Python 3.21.
16181618
def replace(self, old, new, count=_MISSING, *, maxsplit=_MISSING):
16191619
if maxsplit is not _MISSING:
16201620
if count is not _MISSING:
16211621
raise TypeError("'count' and 'maxsplit' are mutually exclusive "
16221622
"and support for 'maxsplit' keyword parameter "
1623-
"is slated for removal in Python 3.18")
1623+
"is slated for removal in Python 3.21")
16241624
import warnings
16251625
warnings._deprecated(
16261626
"maxsplit",
16271627
message="the {name!r} keyword parameter is deprecated since "
16281628
"Python 3.16 and slated for removal in Python {remove}; "
16291629
"use the 'count' keyword parameter or pass the count "
16301630
"as a positional argument instead",
1631-
remove=(3, 18))
1631+
remove=(3, 21))
16321632
count = maxsplit
16331633
elif count is _MISSING:
16341634
count = -1

‎Lib/test/test_userstring.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
DEPRECATED_MAXSPLIT_PARAMETER = re.escape(
1313
"the 'maxsplit' keyword parameter is deprecated since "
14-
"Python 3.16 and slated for removal in Python 3.18; "
14+
"Python 3.16 and slated for removal in Python 3.21; "
1515
"use the 'count' keyword parameter or pass the count "
1616
"as a positional argument instead"
1717
)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
The third parameter of :meth:`!collections.UserString.replace` is now named
22
*count*, matching :meth:`str.replace`, so that it can be passed as a keyword.
33
Support for the undocumented ``maxsplit`` keyword parameter is deprecated and
4-
slated for removal in Python 3.18.
4+
slated for removal in Python 3.21.

0 commit comments

Comments
 (0)