diff options
author | Dwayne C. Litzenberger <dlitz@dlitz.net> | 2011-10-10 23:57:42 -0400 |
---|---|---|
committer | Dwayne C. Litzenberger <dlitz@dlitz.net> | 2011-10-10 23:59:37 -0400 |
commit | 25a055334e5cd9d22777864d2a5c0fd8a88bbcff (patch) | |
tree | 3a10293a8328eae8b48771cbb4f1e259b337b152 | |
parent | 7401e648d44f9324a313346f45e86fc5e779a7aa (diff) | |
download | pycrypto-25a055334e5cd9d22777864d2a5c0fd8a88bbcff.tar.gz |
Don't abuse __builtins__
According to Jean-Paul Calderone at https://bugs.launchpad.net/pycrypto/+bug/785150:
`__builtins__` is an implementation detail of CPython. It takes on
inconsistent values at various times. The use in `common.py` happens to
work on recent version of CPython, but it doesn't work on PyPy. The only
thing you should ever do, when you're doing this sort of thing, is "import
__builtin__; __builtin__.foo".
-rw-r--r-- | ACKS | 1 | ||||
-rw-r--r-- | lib/Crypto/SelfTest/Cipher/common.py | 2 | ||||
-rw-r--r-- | lib/Crypto/SelfTest/Hash/common.py | 2 |
3 files changed, 3 insertions, 2 deletions
@@ -21,6 +21,7 @@ Ian Bicking Joris Bontje Antoon Bosselaers Andrea Bottoni +Jean-Paul Calderone Sergey Chernov Geremy Condra Jan Dittberner diff --git a/lib/Crypto/SelfTest/Cipher/common.py b/lib/Crypto/SelfTest/Cipher/common.py index 93ddd8b..af34e97 100644 --- a/lib/Crypto/SelfTest/Cipher/common.py +++ b/lib/Crypto/SelfTest/Cipher/common.py @@ -38,7 +38,7 @@ if sys.hexversion < 0x02030000: def dict(**kwargs): return kwargs.copy() else: - dict = __builtins__['dict'] + dict = dict class _NoDefault: pass # sentinel object def _extract(d, k, default=_NoDefault): diff --git a/lib/Crypto/SelfTest/Hash/common.py b/lib/Crypto/SelfTest/Hash/common.py index ee3eb07..386a82e 100644 --- a/lib/Crypto/SelfTest/Hash/common.py +++ b/lib/Crypto/SelfTest/Hash/common.py @@ -38,7 +38,7 @@ if sys.hexversion < 0x02030000: def dict(**kwargs): return kwargs.copy() else: - dict = __builtins__['dict'] + dict = dict class HashSelfTest(unittest.TestCase): |