[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pypy-svn
Subject:    [pypy-commit] pypy missing-tp_new: remove the slots for the methods not explicitly overriden in the 
From:       arigo <pypy.commits () gmail ! com>
Date:       2016-10-30 17:16:26
Message-ID: 58162aea.4336c20a.fcad1.ecef () mx ! google ! com
[Download RAW message or body]

Author: Armin Rigo <arigo@tunes.org>
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
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic