aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/random.py
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2018-12-04 14:53:14 -0800
committerGitHub <noreply@github.com>2018-12-04 14:53:14 -0800
commit09473ac0636c16c0ee96c4caf59f3da8ba8b4a57 (patch)
tree9856b6567322f4157689fe0515588d8011f6f358 /Lib/random.py
parentb8e689a6e8134e88f857a55e50b6a4977967e385 (diff)
downloadcpython-09473ac0636c16c0ee96c4caf59f3da8ba8b4a57.tar.gz
cpython-09473ac0636c16c0ee96c4caf59f3da8ba8b4a57.zip
Remove unnecessary and over-restrictive type check (GH-10905)
Diffstat (limited to 'Lib/random.py')
-rw-r--r--Lib/random.py2
1 files changed, 0 insertions, 2 deletions
diff --git a/Lib/random.py b/Lib/random.py
index a7a86070c0a..03c058a39d6 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