Author: mattip <matti.pi...@gmail.com>
Branch: cpyext-ext
Changeset: r81596:26ff9bd62015
Date: 2016-01-05 23:15 +0200
http://bitbucket.org/pypy/pypy/changeset/26ff9bd62015/

Log:    inherit tp_as... slots from base, need to test?

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
@@ -592,7 +592,6 @@
     Creates an interpreter type from a PyTypeObject structure.
     """
     # missing:
-    # inheriting tp_as_* slots
     # unsupported:
     # tp_mro, tp_subclasses
     py_type = rffi.cast(PyTypeObjectPtr, py_obj)
@@ -619,6 +618,13 @@
     w_obj.ready()
 
     finish_type_2(space, py_type, w_obj)
+    # inheriting tp_as_* slots
+    base = py_type.c_tp_base
+    if base:
+        if not py_type.c_tp_as_number: py_type.c_tp_as_number = 
base.c_tp_as_number 
+        if not py_type.c_tp_as_sequence: py_type.c_tp_as_sequence = 
base.c_tp_as_sequence 
+        if not py_type.c_tp_as_mapping: py_type.c_tp_as_mapping = 
base.c_tp_as_mapping 
+        if not py_type.c_tp_as_buffer: py_type.c_tp_as_buffer = 
base.c_tp_as_buffer 
 
     state = space.fromcache(RefcountState)
     state.non_heaptypes_w.append(w_obj)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to