Author: Armin Rigo <ar...@tunes.org> Branch: cpyext-gc-support Changeset: r80453:8fd6a686565e Date: 2015-10-26 09:09 +0100 http://bitbucket.org/pypy/pypy/changeset/8fd6a686565e/
Log: Don't call create_all_slots() on cpyext type objects. Fix for test_typeobject.py:test_sre 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 @@ -527,7 +527,8 @@ convert_getset_defs(space, dict_w, pto.c_tp_getset, w_type) convert_member_defs(space, dict_w, pto.c_tp_members, w_type) - W_TypeObject.__init__(w_type, space, name, bases_w, dict_w) + W_TypeObject.__init__(w_type, space, name, bases_w, dict_w, + from_cpyext=True) if not space.is_true(space.issubtype(w_type, space.w_type)): # ZZZ? w_type.flag_cpytype = True 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 @@ -126,7 +126,7 @@ @dont_look_inside def __init__(w_self, space, name, bases_w, dict_w, - overridetypedef=None): + overridetypedef=None, from_cpyext=False): w_self.space = space w_self.name = name w_self.bases_w = bases_w @@ -146,7 +146,7 @@ if overridetypedef is not None: setup_builtin_type(w_self) else: - setup_user_defined_type(w_self) + setup_user_defined_type(w_self, from_cpyext=from_cpyext) w_self.w_same_layout_as = get_parent_layout(w_self) if space.config.objspace.std.withtypeversion: @@ -1096,7 +1096,7 @@ return False return True -def setup_user_defined_type(w_self): +def setup_user_defined_type(w_self, from_cpyext=False): if len(w_self.bases_w) == 0: w_self.bases_w = [w_self.space.w_object] w_bestbase = check_and_find_best_base(w_self.space, w_self.bases_w) @@ -1108,8 +1108,9 @@ w_self.flag_cpytype |= w_base.flag_cpytype w_self.flag_abstract |= w_base.flag_abstract - hasoldstylebase = copy_flags_from_bases(w_self, w_bestbase) - create_all_slots(w_self, hasoldstylebase, w_bestbase) + if not from_cpyext: + hasoldstylebase = copy_flags_from_bases(w_self, w_bestbase) + create_all_slots(w_self, hasoldstylebase, w_bestbase) ensure_common_attributes(w_self) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit