Skip to content

Commit 0c915e6

Browse files
Doc: sys.__unraisablehook__ and bytearray.hex separators are new in 3.8 (GH-17884)
Minor fix in documentation: - `sys.__unraisablehook__` is new in version 3.8 - Optional `sep` and `bytes_per_sep` parameters for `bytearray.hex` is also supported in Python 3.8 (just like `bytes.hex`) (cherry picked from commit 0edc2c7) Co-authored-by: Saiyang Gou <[email protected]>
1 parent 8b9cebc commit 0c915e6

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

Doc/library/stdtypes.rst

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2399,7 +2399,7 @@ data and are closely related to string objects in a variety of other ways.
23992399
A reverse conversion function exists to transform a bytes object into its
24002400
hexadecimal representation.
24012401

2402-
.. method:: hex()
2402+
.. method:: hex([sep[, bytes_per_sep]])
24032403

24042404
Return a string object containing two hexadecimal digits for each
24052405
byte in the instance.
@@ -2493,7 +2493,7 @@ objects.
24932493
A reverse conversion function exists to transform a bytearray object into its
24942494
hexadecimal representation.
24952495

2496-
.. method:: hex()
2496+
.. method:: hex([sep[, bytes_per_sep]])
24972497

24982498
Return a string object containing two hexadecimal digits for each
24992499
byte in the instance.
@@ -2503,6 +2503,11 @@ objects.
25032503

25042504
.. versionadded:: 3.5
25052505

2506+
.. versionchanged:: 3.8
2507+
Similar to :meth:`bytes.hex`, :meth:`bytearray.hex` now supports
2508+
optional *sep* and *bytes_per_sep* parameters to insert separators
2509+
between bytes in the hex output.
2510+
25062511
Since bytearray objects are sequences of integers (akin to a list), for a
25072512
bytearray object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be
25082513
a bytearray object of length 1. (This contrasts with text strings, where
@@ -3649,7 +3654,7 @@ copying.
36493654
in-memory Fortran order is preserved. For non-contiguous views, the
36503655
data is converted to C first. *order=None* is the same as *order='C'*.
36513656

3652-
.. method:: hex()
3657+
.. method:: hex([sep[, bytes_per_sep]])
36533658

36543659
Return a string object containing two hexadecimal digits for each
36553660
byte in the buffer. ::
@@ -3660,6 +3665,11 @@ copying.
36603665

36613666
.. versionadded:: 3.5
36623667

3668+
.. versionchanged:: 3.8
3669+
Similar to :meth:`bytes.hex`, :meth:`memoryview.hex` now supports
3670+
optional *sep* and *bytes_per_sep* parameters to insert separators
3671+
between bytes in the hex output.
3672+
36633673
.. method:: tolist()
36643674

36653675
Return the data in the buffer as a list of elements. ::

Doc/library/sys.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,8 @@ always available.
343343
.. versionadded:: 3.7
344344
__breakpointhook__
345345

346+
.. versionadded:: 3.8
347+
__unraisablehook__
346348

347349
.. function:: exc_info()
348350

0 commit comments

Comments
 (0)