From 09473ac0636c16c0ee96c4caf59f3da8ba8b4a57 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Tue, 4 Dec 2018 14:53:14 -0800 Subject: [PATCH] Remove unnecessary and over-restrictive type check (GH-10905) --- Lib/random.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/Lib/random.py b/Lib/random.py index a7a86070c0..03c058a39d 100644 --- a/Lib/random.py +++ b/Lib/random.py @@ -718,8 +718,6 @@ class SystemRandom(Random): """getrandbits(k) -> x. Generates an int with k random bits.""" if k <= 0: raise ValueError('number of bits must be greater than zero') - if k != int(k): - raise TypeError('number of bits should be an integer') numbytes = (k + 7) // 8 # bits / 8 and rounded up x = int.from_bytes(_urandom(numbytes), 'big') return x >> (numbytes * 8 - k) # trim excess bits -- 2.49.0