[pypy-commit] pypy default: Issue #2865

arigo pypy.commits at gmail.com
Thu Aug 9 09:47:11 EDT 2018


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r94982:95232deededb
Date: 2018-08-09 15:46 +0200
http://bitbucket.org/pypy/pypy/changeset/95232deededb/

Log:	Issue #2865

	Make types.MemberDescriptorType be the type of app-level slots

diff --git a/lib-python/2.7/types.py b/lib-python/2.7/types.py
--- a/lib-python/2.7/types.py
+++ b/lib-python/2.7/types.py
@@ -83,9 +83,19 @@
 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
 


More information about the pypy-commit mailing list