Author bugs-python@vendor.thewrittenword.com
Recipients bugs-python@vendor.thewrittenword.com, iwienand
Date 2012-08-31.10:39:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1346409573.43.0.398897898187.issue15340@psf.upfronthosting.co.za>
In-reply-to
Content
The root of the problem preventing me from running some 3rd party setup.py scripts correctly is the mismatch between (recently) raising an OSError in Python/random.c, but catching only NotImplementedError in Lib/random.py.

For backwards compatibility (previous releases all raised and caught NotImplementedError), here is a patch that stops Python bailing out with "OSError: No such file or directory /dev/urandom" for me.  Tested with Python-2.6.8, Python-2.7.3 and Python-3.2.3, on HPUX 11.00, HPUX 11.11 and Tru 64 5.1.

Arguably, as long as 3rd party code doesn't rely on the NotImplementedError exception, changing random.py to catch OSErrors would work equally well.

This patch does not stop dev_urandom_noraise() from halting the interpreter on machines with no /dev/urandom, but that seems intentional to me so I didn't try to fix it.
History
Date User Action Args
2012-08-31 10:39:33bugs-python@vendor.thewrittenword.comsetrecipients: + bugs-python@vendor.thewrittenword.com, iwienand
2012-08-31 10:39:33bugs-python@vendor.thewrittenword.comsetmessageid: <1346409573.43.0.398897898187.issue15340@psf.upfronthosting.co.za>
2012-08-31 10:39:32bugs-python@vendor.thewrittenword.comlinkissue15340 messages
2012-08-31 10:39:32bugs-python@vendor.thewrittenword.comcreate