Author: Mark Young <[email protected]>
Branch: py3k
Changeset: r84463:7808db43d429
Date: 2016-05-14 23:09 -0400
http://bitbucket.org/pypy/pypy/changeset/7808db43d429/

Log:    Respond to feedback. Matches cpython's intent more closely.

diff --git a/lib-python/3/inspect.py b/lib-python/3/inspect.py
--- a/lib-python/3/inspect.py
+++ b/lib-python/3/inspect.py
@@ -1333,7 +1333,7 @@
 _NonUserDefinedCallables = (_WrapperDescriptor,
                             _MethodWrapper,
                             types.BuiltinFunctionType)
-
+builtin_code_type = type(dict.update.__code__)
 
 def _get_user_defined_method(cls, method_name):
     try:
@@ -1341,8 +1341,11 @@
     except AttributeError:
         return
     else:
-        if  (meth is not getattr(type, method_name) and
-             meth is not getattr(object, method_name)):
+        try:
+            code = meth.__code__
+        except AttributeError:
+            return
+        if not isinstance(code, builtin_code_type):
             # Once '__signature__' will be added to 'C'-level
             # callables, this check won't be necessary
             return meth
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to