summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorINADA Naoki <songofacandy@gmail.com>2016-10-31 17:42:25 +0900
committerINADA Naoki <songofacandy@gmail.com>2016-10-31 17:42:25 +0900
commitcd7172b25ab066ae464bce14ced01c93bc7f6617 (patch)
tree827eaf9712de0b99604362f618b72255f899f528
parente1b13b644c54086f6742c5bfa0d0c7391c825516 (diff)
parentc1d5ced00f214eeb83daa3d5af14d33497625d1f (diff)
downloadcpython-cd7172b25ab066ae464bce14ced01c93bc7f6617.tar.gz
Issue #28553: Fix logic error in example code of int.to_bytes doc.
-rw-r--r--Doc/library/stdtypes.rst2
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`