diff options
author | INADA Naoki <songofacandy@gmail.com> | 2016-10-31 17:42:25 +0900 |
---|---|---|
committer | INADA Naoki <songofacandy@gmail.com> | 2016-10-31 17:42:25 +0900 |
commit | a99cdb21a7d67ce5d1e3cc93b08eb3b6eecba60b (patch) | |
tree | 21360c3bbd0be23df13a526f2fd3cbc95cc98c86 | |
parent | ecf40c1dce96ec2db49a9d95bd0df94cb6bce32f (diff) | |
parent | f9cb5593e382b0781471668624dab36dd5aafea9 (diff) | |
download | cpython-git-a99cdb21a7d67ce5d1e3cc93b08eb3b6eecba60b.tar.gz |
Issue #28553: Fix logic error in example code of int.to_bytes 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 19a02ff033..122ed00387 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` |