diff options
author | INADA Naoki <songofacandy@gmail.com> | 2016-10-31 08:41:47 (GMT) |
---|---|---|
committer | INADA Naoki <songofacandy@gmail.com> | 2016-10-31 08:41:47 (GMT) |
commit | 3e3e9f3667bd542ab75e38816c57eaeb12946aff (patch) | |
tree | 416ad8afd1b5088e97081a4fe3dbfd109d6146d3 /Doc | |
parent | 04f17f103afcee73c65709252b0dba6411df7665 (diff) | |
download | cpython-3e3e9f3667bd542ab75e38816c57eaeb12946aff.zip cpython-3e3e9f3667bd542ab75e38816c57eaeb12946aff.tar.gz cpython-3e3e9f3667bd542ab75e38816c57eaeb12946aff.tar.bz2 |
Issue #28553: Fix logic error in example code of int.to_bytes doc.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/stdtypes.rst | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 2587ac8..5936c68 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -485,7 +485,7 @@ class`. In addition, it provides a few more methods: >>> (-1024).to_bytes(10, byteorder='big', signed=True) b'\xff\xff\xff\xff\xff\xff\xff\xff\xfc\x00' >>> x = 1000 - >>> x.to_bytes((x.bit_length() // 8) + 1, byteorder='little') + >>> x.to_bytes((x.bit_length() + 7) // 8, byteorder='little') b'\xe8\x03' The integer is represented using *length* bytes. An :exc:`OverflowError` |