diff options
author | INADA Naoki <songofacandy@gmail.com> | 2016-10-31 08:42:10 (GMT) |
---|---|---|
committer | INADA Naoki <songofacandy@gmail.com> | 2016-10-31 08:42:10 (GMT) |
commit | f9cb5593e382b0781471668624dab36dd5aafea9 (patch) | |
tree | ba5358e3923da8c7f650386c14b292a4964dfa71 /Doc | |
parent | 88b221935895dd56ebae3a3299897ac9cd0c6eb2 (diff) | |
parent | 3e3e9f3667bd542ab75e38816c57eaeb12946aff (diff) | |
download | cpython-f9cb5593e382b0781471668624dab36dd5aafea9.zip cpython-f9cb5593e382b0781471668624dab36dd5aafea9.tar.gz cpython-f9cb5593e382b0781471668624dab36dd5aafea9.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 19a02ff..122ed00 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` |