mirror of
https://github.com/python/cpython.git
synced 2025-11-09 10:01:42 +00:00
[3.14] gh-118803: Improve documentation around ByteString deprecation (GH-139115) (#139136)
gh-118803: Improve documentation around `ByteString` deprecation (GH-139115)
(cherry picked from commit 4305cc3ef3)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
parent
e560865120
commit
665a3495bf
5 changed files with 94 additions and 20 deletions
|
|
@ -1082,9 +1082,13 @@ def __instancecheck__(cls, instance):
|
|||
return super().__instancecheck__(instance)
|
||||
|
||||
class ByteString(Sequence, metaclass=_DeprecateByteStringMeta):
|
||||
"""This unifies bytes and bytearray.
|
||||
"""Deprecated ABC serving as a common supertype of ``bytes`` and ``bytearray``.
|
||||
|
||||
XXX Should add all their methods.
|
||||
This ABC is scheduled for removal in Python 3.17.
|
||||
Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj``
|
||||
implements the buffer protocol at runtime. For use in type annotations,
|
||||
either use ``Buffer`` or a union that explicitly specifies the types your
|
||||
code supports (e.g., ``bytes | bytearray | memoryview``).
|
||||
"""
|
||||
|
||||
__slots__ = ()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue