~ubuntu-branches/ubuntu/precise/python3.2/precise-proposed

« back to all changes in this revision

Viewing changes to Lib/os.py

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2012-03-09 18:40:39 UTC
  • mfrom: (30.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20120309184039-j3yk2emxr1plyo21
Tags: 3.2.3~rc1-1
* Python 3.2.3 release candidate 1.
* Update to 20120309 from the 3.2 branch.
* Fix libpython.a symlink. Closes: #660146.
* Build-depend on xauth.
* Run the gdb tests for the debug build only.

Show diffs side-by-side

added added

removed removed

Lines of Context:
761
761
except NameError: # statvfs_result may not exist
762
762
    pass
763
763
 
764
 
if not _exists("urandom"):
765
 
    def urandom(n):
766
 
        """urandom(n) -> str
767
 
 
768
 
        Return a string of n random bytes suitable for cryptographic use.
769
 
 
770
 
        """
771
 
        try:
772
 
            _urandomfd = open("/dev/urandom", O_RDONLY)
773
 
        except (OSError, IOError):
774
 
            raise NotImplementedError("/dev/urandom (or equivalent) not found")
775
 
        bs = b""
776
 
        while len(bs) < n:
777
 
            bs += read(_urandomfd, n - len(bs))
778
 
        close(_urandomfd)
779
 
        return bs
780
 
 
781
764
# Supply os.popen()
782
765
def popen(cmd, mode="r", buffering=-1):
783
766
    if not isinstance(cmd, str):