[pypy-svn] r77772 - pypy/branch/fast-forward/lib-python/modified-2.7.0
afa at codespeak.net
afa at codespeak.net
Mon Oct 11 08:30:54 CEST 2010
Author: afa
Date: Mon Oct 11 08:30:53 2010
New Revision: 77772
Modified:
pypy/branch/fast-forward/lib-python/modified-2.7.0/random.py
Log:
Revert r77770. Bound methods cannot be compared by identity,
"self.random" yields a different object every time.
Modified: pypy/branch/fast-forward/lib-python/modified-2.7.0/random.py
==============================================================================
--- pypy/branch/fast-forward/lib-python/modified-2.7.0/random.py (original)
+++ pypy/branch/fast-forward/lib-python/modified-2.7.0/random.py Mon Oct 11 08:30:53 2010
@@ -254,8 +254,8 @@
# Only call self.getrandbits if the original random() builtin method
# has not been overridden or if a new getrandbits() was supplied.
# This assures that the two methods correspond.
- if (self.random is super(Random, self).random or
- getrandbits is not super(Random, self).getrandbits):
+ if (self.random == super(Random, self).random or
+ getrandbits != super(Random, self).getrandbits):
k = int(1.00001 + _log(n-1, 2.0)) # 2**k > n-1 > 2**(k-2)
r = getrandbits(k)
while r >= n:
More information about the Pypy-commit
mailing list