Skip to content

Commit 09473ac

Browse files
authored
Remove unnecessary and over-restrictive type check (GH-10905)
1 parent b8e689a commit 09473ac

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

Lib/random.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,8 +718,6 @@ def getrandbits(self, k):
718718
"""getrandbits(k) -> x. Generates an int with k random bits."""
719719
if k <= 0:
720720
raise ValueError('number of bits must be greater than zero')
721-
if k != int(k):
722-
raise TypeError('number of bits should be an integer')
723721
numbytes = (k + 7) // 8 # bits / 8 and rounded up
724722
x = int.from_bytes(_urandom(numbytes), 'big')
725723
return x >> (numbytes * 8 - k) # trim excess bits

0 commit comments

Comments
 (0)