Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Deprecate for recommended five years
  • Loading branch information
hugovk authored Sep 17, 2025
commit 6bb4cbe8d464cc3d18fd72f0ea7400386b38776e
15 changes: 7 additions & 8 deletions Doc/deprecations/pending-removal-in-3.17.rst
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
Pending removal in Python 3.17
------------------------------

* :mod:`collections.abc`:

- :class:`collections.abc.ByteString` is scheduled for removal in Python 3.17. Prefer
:class:`~collections.abc.Sequence` or :class:`~collections.abc.Buffer`. For use in
type annotations, prefer a union, like ``bytes | bytearray``, or
:class:`collections.abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)

* :mod:`typing`:

- Before Python 3.14, old-style unions were implemented using the private class
``typing._UnionGenericAlias``. This class is no longer needed for the implementation,
but it has been retained for backward compatibility, with removal scheduled for Python
3.17. Users should use documented introspection helpers like :func:`typing.get_origin`
and :func:`typing.get_args` instead of relying on private implementation details.

- :class:`typing.ByteString`, deprecated since Python 3.9, is scheduled for removal in
Python 3.17. Prefer :class:`~collections.abc.Sequence` or
:class:`~collections.abc.Buffer`. For use in type annotations, prefer a union, like
``bytes | bytearray``, or :class:`collections.abc.Buffer`.
(Contributed by Shantanu Jain in :gh:`91896`.)
Comment thread
hugovk marked this conversation as resolved.

* :mod:`collections.abc`:

- :class:`collections.abc.ByteString` is scheduled for removal in Python 3.17. Prefer
:class:`~collections.abc.Sequence` or :class:`~collections.abc.Buffer`. For use in
type annotations, prefer a union, like ``bytes | bytearray``, or
:class:`collections.abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)
2 changes: 1 addition & 1 deletion Lib/test/test_argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -7360,7 +7360,7 @@ class TestModule(unittest.TestCase):
def test_deprecated__version__(self):
with self.assertWarnsRegex(
DeprecationWarning,
"'__version__' is deprecated and slated for removal in Python 3.17",
"'__version__' is deprecated and slated for removal in Python 3.20",
) as cm:
getattr(argparse, "__version__")
self.assertEqual(cm.filename, __file__)
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -1608,7 +1608,7 @@ class TestModule(unittest.TestCase):
def test_deprecated__version__(self):
with self.assertWarnsRegex(
DeprecationWarning,
"'__version__' is deprecated and slated for removal in Python 3.17",
"'__version__' is deprecated and slated for removal in Python 3.20",
) as cm:
getattr(csv, "__version__")
self.assertEqual(cm.filename, __file__)
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_ctypes/test_macholib.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def test_deprecated__version__(self):

with self.assertWarnsRegex(
DeprecationWarning,
"'__version__' is deprecated and slated for removal in Python 3.17",
"'__version__' is deprecated and slated for removal in Python 3.20",
) as cm:
getattr(ctypes.macholib, "__version__")
self.assertEqual(cm.filename, __file__)
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_ipaddress.py
Original file line number Diff line number Diff line change
Expand Up @@ -2825,7 +2825,7 @@ class TestModule(unittest.TestCase):
def test_deprecated__version__(self):
with self.assertWarnsRegex(
DeprecationWarning,
"'__version__' is deprecated and slated for removal in Python 3.17",
"'__version__' is deprecated and slated for removal in Python 3.20",
) as cm:
getattr(ipaddress, "__version__")
self.assertEqual(cm.filename, __file__)
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_json/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class TestModule(unittest.TestCase):
def test_deprecated__version__(self):
with self.assertWarnsRegex(
DeprecationWarning,
"'__version__' is deprecated and slated for removal in Python 3.17",
"'__version__' is deprecated and slated for removal in Python 3.20",
) as cm:
getattr(json, "__version__")
self.assertEqual(cm.filename, __file__)
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -7238,7 +7238,7 @@ def test__all__(self):

class TestModule(unittest.TestCase):
def test_deprecated__version__and__date__(self):
msg = "is deprecated and slated for removal in Python 3.17"
msg = "is deprecated and slated for removal in Python 3.20"
for attr in ("__version__", "__date__"):
with self.subTest(attr=attr):
with self.assertWarnsRegex(DeprecationWarning, msg) as cm:
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_optparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -1670,7 +1670,7 @@ class TestModule(unittest.TestCase):
def test_deprecated__version__(self):
with self.assertWarnsRegex(
DeprecationWarning,
"'__version__' is deprecated and slated for removal in Python 3.17",
"'__version__' is deprecated and slated for removal in Python 3.20",
) as cm:
getattr(optparse, "__version__")
self.assertEqual(cm.filename, __file__)
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_re.py
Original file line number Diff line number Diff line change
Expand Up @@ -3120,7 +3120,7 @@ class TestModule(unittest.TestCase):
def test_deprecated__version__(self):
with self.assertWarnsRegex(
DeprecationWarning,
"'__version__' is deprecated and slated for removal in Python 3.17",
"'__version__' is deprecated and slated for removal in Python 3.20",
) as cm:
getattr(re, "__version__")
self.assertEqual(cm.filename, __file__)
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_socketserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ class TestModule(unittest.TestCase):
def test_deprecated__version__(self):
with self.assertWarnsRegex(
DeprecationWarning,
"'__version__' is deprecated and slated for removal in Python 3.17",
"'__version__' is deprecated and slated for removal in Python 3.20",
) as cm:
getattr(socketserver, "__version__")
self.assertEqual(cm.filename, __file__)
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_tabnanny.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ class TestModule(TestCase):
def test_deprecated__version__(self):
with self.assertWarnsRegex(
DeprecationWarning,
"'__version__' is deprecated and slated for removal in Python 3.17",
"'__version__' is deprecated and slated for removal in Python 3.20",
) as cm:
getattr(tabnanny, "__version__")
self.assertEqual(cm.filename, __file__)
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_tkinter/test_font.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class TestModule(unittest.TestCase):
def test_deprecated__version__(self):
with self.assertWarnsRegex(
DeprecationWarning,
"'__version__' is deprecated and slated for removal in Python 3.17",
"'__version__' is deprecated and slated for removal in Python 3.20",
) as cm:
getattr(font, "__version__")
self.assertEqual(cm.filename, __file__)
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_ttk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class TestModule(unittest.TestCase):
def test_deprecated__version__(self):
with self.assertWarnsRegex(
DeprecationWarning,
"'__version__' is deprecated and slated for removal in Python 3.17",
"'__version__' is deprecated and slated for removal in Python 3.20",
) as cm:
getattr(ttk, "__version__")
self.assertEqual(cm.filename, __file__)
Expand Down
Loading