1
1
Pending removal in Python 3.17
2
2
------------------------------
3
3
4
+ * :mod: `collections.abc `:
5
+
6
+ - :class: `collections.abc.ByteString ` is scheduled for removal in Python 3.17.
7
+
8
+ Use ``isinstance(obj, collections.abc.Buffer) `` to test if ``obj ``
9
+ implements the :ref: `buffer protocol <bufferobjects >` at runtime. For use
10
+ in type annotations, either use :class: `~collections.abc.Buffer ` or a union
11
+ that explicitly specifies the types your code supports (e.g.,
12
+ ``bytes | bytearray | memoryview ``).
13
+
14
+ :class: `!ByteString ` was originally intended to be an abstract class that
15
+ would serve as a supertype of both :class: `bytes ` and :class: `bytearray `.
16
+ However, since the ABC never had any methods, knowing that an object was an
17
+ instance of :class: `!ByteString ` never actually told you anything useful
18
+ about the object. Other common buffer types such as :class: `memoryview `
19
+ were also never understood as subtypes of :class: `!ByteString ` (either at
20
+ runtime or by static type checkers).
21
+
22
+ See :pep: `PEP 688 <688#current-options >` for more details.
23
+ (Contributed by Shantanu Jain in :gh: `91896 `.)
24
+
25
+
4
26
* :mod: `typing `:
5
27
6
28
- Before Python 3.14, old-style unions were implemented using the private class
@@ -9,14 +31,21 @@ Pending removal in Python 3.17
9
31
3.17. Users should use documented introspection helpers like :func: `typing.get_origin `
10
32
and :func: `typing.get_args ` instead of relying on private implementation details.
11
33
- :class: `typing.ByteString `, deprecated since Python 3.9, is scheduled for removal in
12
- Python 3.17. Prefer :class: `~collections.abc.Sequence ` or
13
- :class: `~collections.abc.Buffer `. For use in type annotations, prefer a union, like
14
- ``bytes | bytearray ``, or :class: `collections.abc.Buffer `.
15
- (Contributed by Shantanu Jain in :gh: `91896 `.)
34
+ Python 3.17.
16
35
17
- * :mod: `collections.abc `:
36
+ Use ``isinstance(obj, collections.abc.Buffer) `` to test if ``obj ``
37
+ implements the :ref: `buffer protocol <bufferobjects >` at runtime. For use
38
+ in type annotations, either use :class: `~collections.abc.Buffer ` or a union
39
+ that explicitly specifies the types your code supports (e.g.,
40
+ ``bytes | bytearray | memoryview ``).
41
+
42
+ :class: `!ByteString ` was originally intended to be an abstract class that
43
+ would serve as a supertype of both :class: `bytes ` and :class: `bytearray `.
44
+ However, since the ABC never had any methods, knowing that an object was an
45
+ instance of :class: `!ByteString ` never actually told you anything useful
46
+ about the object. Other common buffer types such as :class: `memoryview `
47
+ were also never understood as subtypes of :class: `!ByteString ` (either at
48
+ runtime or by static type checkers).
18
49
19
- - :class: `collections.abc.ByteString ` is scheduled for removal in Python 3.17. Prefer
20
- :class: `~collections.abc.Sequence ` or :class: `~collections.abc.Buffer `. For use in
21
- type annotations, prefer a union, like ``bytes | bytearray ``, or
22
- :class: `collections.abc.Buffer `. (Contributed by Shantanu Jain in :gh: `91896 `.)
50
+ See :pep: `PEP 688 <688#current-options >` for more details.
51
+ (Contributed by Shantanu Jain in :gh: `91896 `.)
0 commit comments