summaryrefslogtreecommitdiff
path: root/Lib/os.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-02-20 21:44:56 -0500
committerBenjamin Peterson <benjamin@python.org>2012-02-20 21:44:56 -0500
commitaee9dfba4a9230f2832dd69d67e92f8e0490a163 (patch)
tree27a9896969ac7ff79dc75017cff121a077c3eb6e /Lib/os.py
parent34b345b8885e5db8ab6627c081ca86a8b78b6989 (diff)
parentb19fb2462eac776746f6cb40cc84b0587c83b9bc (diff)
downloadcpython-git-aee9dfba4a9230f2832dd69d67e92f8e0490a163.tar.gz
merge 2.6 with hash randomization fix
Diffstat (limited to 'Lib/os.py')
-rw-r--r--Lib/os.py19
1 files changed, 0 insertions, 19 deletions
diff --git a/Lib/os.py b/Lib/os.py
index c612e17ece..6d598f3e91 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -738,22 +738,3 @@ try:
_make_statvfs_result)
except NameError: # statvfs_result may not exist
pass
-
-if not _exists("urandom"):
- def urandom(n):
- """urandom(n) -> str
-
- Return a string of n random bytes suitable for cryptographic use.
-
- """
- try:
- _urandomfd = open("/dev/urandom", O_RDONLY)
- except (OSError, IOError):
- raise NotImplementedError("/dev/urandom (or equivalent) not found")
- try:
- bs = b""
- while n > len(bs):
- bs += read(_urandomfd, n - len(bs))
- finally:
- close(_urandomfd)
- return bs