Author: Armin Rigo <[email protected]>
Branch: missing-tp_new
Changeset: r87997:0d51cac70bb9
Date: 2016-10-30 18:15 +0100
http://bitbucket.org/pypy/pypy/changeset/0d51cac70bb9/

Log:    remove the slots for the methods not explicitly overriden in the
        app-level class

diff --git a/pypy/module/cpyext/typeobject.py b/pypy/module/cpyext/typeobject.py
--- a/pypy/module/cpyext/typeobject.py
+++ b/pypy/module/cpyext/typeobject.py
@@ -246,11 +246,22 @@
 
     if w_type.is_heaptype():
         typedef = None
+        search_dict_w = w_type.dict_w
     else:
         typedef = w_type.layout.typedef
+        search_dict_w = None
 
     for method_name, slot_name, slot_names, slot_func in slotdefs_for_tp_slots:
-        w_descr = w_type.lookup(method_name)
+        if search_dict_w is not None:
+            # heap type: only look in this exact class
+            #if method_name in search_dict_w and method_name == '__new__':
+            #    import pdb;pdb.set_trace()
+            w_descr = search_dict_w.get(method_name, None)
+        else:
+            # built-in types: expose as many slots as possible, even
+            # if it happens to come from some parent class
+            w_descr = w_type.lookup(method_name)
+
         if w_descr is None:
             # XXX special case iternext
             continue
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to