Author: Ronan Lamy <ronan.l...@gmail.com> Branch: Changeset: r89029:deb24ecc88aa Date: 2016-12-12 17:03 +0000 http://bitbucket.org/pypy/pypy/changeset/deb24ecc88aa/
Log: Set w_type.flag_heaptype from an explicitly given argument to the constructor 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 @@ -466,9 +466,9 @@ new_layout = (pto.c_tp_basicsize > minsize or pto.c_tp_itemsize > 0) W_TypeObject.__init__(self, space, name, - bases_w or [space.w_object], dict_w, force_new_layout=new_layout) + bases_w or [space.w_object], dict_w, force_new_layout=new_layout, + is_heaptype=flag_heaptype) self.flag_cpytype = True - self.flag_heaptype = flag_heaptype # if a sequence or a mapping, then set the flag to force it if pto.c_tp_as_sequence and pto.c_tp_as_sequence.c_sq_item: self.flag_map_or_seq = 'S' 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 @@ -162,7 +162,8 @@ @dont_look_inside def __init__(self, space, name, bases_w, dict_w, - overridetypedef=None, force_new_layout=False): + overridetypedef=None, force_new_layout=False, + is_heaptype=True): self.space = space self.name = name self.bases_w = bases_w @@ -172,7 +173,7 @@ self.weakrefable = False self.w_doc = space.w_None self.weak_subclasses = [] - self.flag_heaptype = False + self.flag_heaptype = is_heaptype self.flag_cpytype = False self.flag_abstract = False self.flag_sequence_bug_compat = False @@ -740,7 +741,7 @@ dict_w[key] = space.getitem(w_dict, w_key) w_type = space.allocate_instance(W_TypeObject, w_typetype) W_TypeObject.__init__(w_type, space, name, bases_w or [space.w_object], - dict_w) + dict_w, is_heaptype=True) w_type.ready() return w_type @@ -1138,7 +1139,6 @@ 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) - w_self.flag_heaptype = True for w_base in w_self.bases_w: if not isinstance(w_base, W_TypeObject): continue @@ -1159,7 +1159,6 @@ w_self.weakrefable = instancetypedef.weakrefable w_self.w_doc = w_self.space.wrap(instancetypedef.doc) ensure_common_attributes(w_self) - w_self.flag_heaptype = instancetypedef.heaptype # # usually 'instancetypedef' is new, i.e. not seen in any base, # but not always (see Exception class) @@ -1333,7 +1332,8 @@ else: overridetypedef = typedef w_type = W_TypeObject(space, typedef.name, bases_w, dict_w, - overridetypedef=overridetypedef) + overridetypedef=overridetypedef, + is_heaptype=overridetypedef.heaptype) if typedef is not overridetypedef: w_type.w_doc = space.wrap(typedef.doc) if hasattr(typedef, 'flag_sequence_bug_compat'): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit