aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2018-09-11 20:56:27 +0300
committerMatti Picus <matti.picus@gmail.com>2018-09-11 20:56:27 +0300
commit0274e1d7132bcf5fa253c2b176aa6dec172220d4 (patch)
treebd22db3832382727a31cb57efc12badc8be99b51 /lib-python
parentmerge default into branch (diff)
parenttwo completely corner cases where we differ from CPython (diff)
downloadpypy-0274e1d7132bcf5fa253c2b176aa6dec172220d4.tar.gz
pypy-0274e1d7132bcf5fa253c2b176aa6dec172220d4.tar.bz2
pypy-0274e1d7132bcf5fa253c2b176aa6dec172220d4.zip
merge default into branch
Diffstat (limited to 'lib-python')
-rw-r--r--lib-python/2.7/hashlib.py7
-rw-r--r--lib-python/2.7/types.py14
2 files changed, 18 insertions, 3 deletions
diff --git a/lib-python/2.7/hashlib.py b/lib-python/2.7/hashlib.py
index bbd06b9996..3099ee48ea 100644
--- a/lib-python/2.7/hashlib.py
+++ b/lib-python/2.7/hashlib.py
@@ -136,9 +136,14 @@ try:
__get_hash = __get_openssl_constructor
algorithms_available = algorithms_available.union(
_hashlib.openssl_md_meth_names)
-except ImportError:
+except ImportError as e:
new = __py_new
__get_hash = __get_builtin_constructor
+ # added by PyPy
+ import warnings
+ warnings.warn("The _hashlib module is not available, falling back "
+ "to a much slower implementation (%s)" % str(e),
+ RuntimeWarning)
for __func_name in __always_supported:
# try them all, some may not work due to the OpenSSL
diff --git a/lib-python/2.7/types.py b/lib-python/2.7/types.py
index b964a3ce4d..2b97fe4669 100644
--- a/lib-python/2.7/types.py
+++ b/lib-python/2.7/types.py
@@ -83,9 +83,19 @@ EllipsisType = type(Ellipsis)
DictProxyType = type(TypeType.__dict__)
NotImplementedType = type(NotImplemented)
-# For Jython, the following two types are identical
+#
+# On CPython, FunctionType.__code__ is a 'getset_descriptor', but
+# FunctionType.__globals__ is a 'member_descriptor', just like app-level
+# slots. On PyPy, all descriptors of built-in types are
+# 'getset_descriptor', but the app-level slots are 'member_descriptor'
+# as well. (On Jython the situation might still be different.)
+#
+# Note that MemberDescriptorType was equal to GetSetDescriptorType in
+# PyPy <= 6.0.
+#
GetSetDescriptorType = type(FunctionType.func_code)
-MemberDescriptorType = type(FunctionType.func_globals)
+class _C(object): __slots__ = 's'
+MemberDescriptorType = type(_C.s)
del sys, _f, _g, _C, _x # Not for export