We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c30deb2 commit f7d8a55Copy full SHA for f7d8a55
1 file changed
Lib/enum.py
@@ -129,7 +129,7 @@ def show_flag_values(value):
129
def bin(num, max_bits=None):
130
"""
131
Like built-in bin(), except negative values are represented in
132
- twos-compliment, and the leading bit always indicates sign
+ twos-complement, and the leading bit always indicates sign
133
(0=positive, 1=negative).
134
135
>>> bin(10)
@@ -138,6 +138,7 @@ def bin(num, max_bits=None):
138
'0b1 0101'
139
140
141
+ num = num.__index__()
142
ceiling = 2 ** (num).bit_length()
143
if num >= 0:
144
s = bltns.bin(num + ceiling).replace('1', '0', 1)
0 commit comments