[pypy-commit] pypy cpyext-subclass-setattr: be more selective in setting w_obj.flag_cpytype, fixes translated test

mattip pypy.commits at gmail.com
Sun Apr 1 11:00:19 EDT 2018


Author: Matti Picus <matti.picus at gmail.com>
Branch: cpyext-subclass-setattr
Changeset: r94214:36ff2c150968
Date: 2018-04-01 17:59 +0300
http://bitbucket.org/pypy/pypy/changeset/36ff2c150968/

Log:	be more selective in setting w_obj.flag_cpytype, fixes translated
	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
@@ -858,6 +858,7 @@
     track_reference(space, py_obj, w_obj)
     # __init__ wraps all slotdefs functions from py_type via add_operators
     w_obj.__init__(space, py_type)
+    w_obj.flag_cpytype = True
     w_obj.ready()
 
     finish_type_2(space, py_type, w_obj)
diff --git a/pypy/objspace/std/typeobject.py b/pypy/objspace/std/typeobject.py
--- a/pypy/objspace/std/typeobject.py
+++ b/pypy/objspace/std/typeobject.py
@@ -1199,7 +1199,9 @@
     for w_base in w_self.bases_w:
         if not isinstance(w_base, W_TypeObject):
             continue
-        w_self.flag_cpytype |= w_base.flag_cpytype
+        # set only in cpyext type_realize, so user-created types will
+        # still use w_root_attach_pyobj (in cpyext.pyobject)
+        #w_self.flag_cpytype |= w_base.flag_cpytype
         w_self.flag_abstract |= w_base.flag_abstract
         if w_self.flag_map_or_seq == '?':
             w_self.flag_map_or_seq = w_base.flag_map_or_seq


More information about the pypy-commit mailing list