[pypy-commit] pypy cpyext-null-slots: abandon making int(np.string_('abc')) raise a ValueError

mattip pypy.commits at gmail.com
Mon Sep 26 15:11:30 EDT 2016


Author: Matti Picus <matti.picus at gmail.com>
Branch: cpyext-null-slots
Changeset: r87397:d37191c0da88
Date: 2016-09-26 21:57 +0300
http://bitbucket.org/pypy/pypy/changeset/d37191c0da88/

Log:	abandon making int(np.string_('abc')) raise a ValueError

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
@@ -479,10 +479,6 @@
         if pto.c_tp_doc:
             self.w_doc = space.wrap(rffi.charp2str(pto.c_tp_doc))
 
-    def lookup(self, name):
-        # do not traverse the mro, look only in self
-        return self.getdictvalue(self.space, name)
-
 @bootstrap_function
 def init_typeobject(space):
     make_typedescr(space.w_type.layout.typedef,
@@ -823,25 +819,17 @@
     # inheriting tp_as_* slots
     base = py_type.c_tp_base
     if base:
-        remap_slots = False
         if not py_type.c_tp_as_number: 
             py_type.c_tp_as_number = base.c_tp_as_number
             py_type.c_tp_flags |= base.c_tp_flags & Py_TPFLAGS_CHECKTYPES
             py_type.c_tp_flags |= base.c_tp_flags & Py_TPFLAGS_HAVE_INPLACEOPS
-            remap_slots = True
         if not py_type.c_tp_as_sequence:
             py_type.c_tp_as_sequence = base.c_tp_as_sequence
             py_type.c_tp_flags |= base.c_tp_flags & Py_TPFLAGS_HAVE_INPLACEOPS
-            remap_slots = True
         if not py_type.c_tp_as_mapping:
             py_type.c_tp_as_mapping = base.c_tp_as_mapping
-            remap_slots = True
         if not py_type.c_tp_as_buffer:
             py_type.c_tp_as_buffer = base.c_tp_as_buffer
-            remap_slots = True
-        if remap_slots:
-            add_operators(space, w_obj.dict_w, py_type)
-
     return w_obj
 
 def finish_type_1(space, pto):


More information about the pypy-commit mailing list