Author: Ronan Lamy <ronan.l...@gmail.com> Branch: cpyext-gc-support-2 Changeset: r82401:f7a259fbc9f7 Date: 2016-02-22 18:07 +0100 http://bitbucket.org/pypy/pypy/changeset/f7a259fbc9f7/
Log: fix references to .instancetypedef diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py --- a/pypy/module/cpyext/api.py +++ b/pypy/module/cpyext/api.py @@ -944,7 +944,7 @@ py_obj = static_pyobjs[i] w_obj = static_objs_w[i] w_type = space.type(w_obj) - typedescr = get_typedescr(w_type.instancetypedef) + typedescr = get_typedescr(w_type.layout.typedef) py_obj.c_ob_type = rffi.cast(PyTypeObjectPtr, make_ref(space, w_type)) typedescr.attach(space, py_obj, w_obj) @@ -1142,7 +1142,7 @@ if not use_micronumpy: return use_micronumpy # import to register api functions by side-effect - import pypy.module.cpyext.ndarrayobject + import pypy.module.cpyext.ndarrayobject global GLOBALS, SYMBOLS_C, separate_module_files GLOBALS["PyArray_Type#"]= ('PyTypeObject*', "space.gettypeobject(W_NDimArray.typedef)") SYMBOLS_C += ['PyArray_Type', '_PyArray_FILLWBYTE', '_PyArray_ZEROS'] diff --git a/pypy/module/cpyext/bufferobject.py b/pypy/module/cpyext/bufferobject.py --- a/pypy/module/cpyext/bufferobject.py +++ b/pypy/module/cpyext/bufferobject.py @@ -25,7 +25,7 @@ @bootstrap_function def init_bufferobject(space): "Type description of PyBufferObject" - make_typedescr(space.w_buffer.instancetypedef, + make_typedescr(space.w_buffer.layout.typedef, basestruct=PyBufferObject.TO, attach=buffer_attach, dealloc=buffer_dealloc, diff --git a/pypy/module/cpyext/intobject.py b/pypy/module/cpyext/intobject.py --- a/pypy/module/cpyext/intobject.py +++ b/pypy/module/cpyext/intobject.py @@ -19,7 +19,7 @@ @bootstrap_function def init_intobject(space): "Type description of PyIntObject" - make_typedescr(space.w_int.instancetypedef, + make_typedescr(space.w_int.layout.typedef, basestruct=PyIntObject.TO, attach=int_attach, realize=int_realize) @@ -51,7 +51,7 @@ @cpython_api([lltype.Signed], PyObject) def PyInt_FromLong(space, ival): """Create a new integer object with a value of ival. - + """ return space.wrap(ival) diff --git a/pypy/module/cpyext/object.py b/pypy/module/cpyext/object.py --- a/pypy/module/cpyext/object.py +++ b/pypy/module/cpyext/object.py @@ -31,7 +31,7 @@ def _PyObject_NewVar(space, type, itemcount): w_type = from_ref(space, rffi.cast(PyObject, type)) assert isinstance(w_type, W_TypeObject) - typedescr = get_typedescr(w_type.instancetypedef) + typedescr = get_typedescr(w_type.layout.typedef) py_obj = typedescr.allocate(space, w_type, itemcount=itemcount) #py_obj.c_ob_refcnt = 0 --- will be set to 1 again by PyObject_Init{Var} if type.c_tp_itemsize == 0: diff --git a/pypy/module/cpyext/pyobject.py b/pypy/module/cpyext/pyobject.py --- a/pypy/module/cpyext/pyobject.py +++ b/pypy/module/cpyext/pyobject.py @@ -115,7 +115,7 @@ def init_pyobject(space): from pypy.module.cpyext.object import PyObject_dealloc # typedescr for the 'object' type - make_typedescr(space.w_object.instancetypedef, + make_typedescr(space.w_object.layout.typedef, dealloc=PyObject_dealloc) # almost all types, which should better inherit from object. make_typedescr(None) @@ -207,7 +207,7 @@ raise InvalidPointerException(str(ref)) w_type = from_ref(space, ref_type) assert isinstance(w_type, W_TypeObject) - return get_typedescr(w_type.instancetypedef).realize(space, ref) + return get_typedescr(w_type.layout.typedef).realize(space, ref) def debug_collect(): @@ -327,7 +327,7 @@ obj.c_ob_refcnt = 1 w_type = from_ref(space, rffi.cast(PyObject, obj.c_ob_type)) assert isinstance(w_type, W_TypeObject) - get_typedescr(w_type.instancetypedef).realize(space, obj) + get_typedescr(w_type.layout.typedef).realize(space, obj) @cpython_api([PyObject], lltype.Void) def _Py_Dealloc(space, obj): diff --git a/pypy/module/cpyext/stringobject.py b/pypy/module/cpyext/stringobject.py --- a/pypy/module/cpyext/stringobject.py +++ b/pypy/module/cpyext/stringobject.py @@ -59,7 +59,7 @@ @bootstrap_function def init_stringobject(space): "Type description of PyStringObject" - make_typedescr(space.w_str.instancetypedef, + make_typedescr(space.w_str.layout.typedef, basestruct=PyStringObject.TO, attach=string_attach, dealloc=string_dealloc, @@ -73,7 +73,7 @@ interpreter object. The buffer may be mutated, until string_realize() is called. Refcount of the result is 1. """ - typedescr = get_typedescr(space.w_str.instancetypedef) + typedescr = get_typedescr(space.w_str.layout.typedef) py_obj = typedescr.allocate(space, space.w_str) py_str = rffi.cast(PyStringObject, py_obj) diff --git a/pypy/module/cpyext/tupleobject.py b/pypy/module/cpyext/tupleobject.py --- a/pypy/module/cpyext/tupleobject.py +++ b/pypy/module/cpyext/tupleobject.py @@ -35,7 +35,7 @@ @bootstrap_function def init_stringobject(space): "Type description of PyTupleObject" - make_typedescr(space.w_tuple.instancetypedef, + make_typedescr(space.w_tuple.layout.typedef, basestruct=PyTupleObject.TO, attach=tuple_attach, dealloc=tuple_dealloc, @@ -54,7 +54,7 @@ corresponding interpreter object. The array may be mutated, until tuple_realize() is called. Refcount of the result is 1. """ - typedescr = get_typedescr(space.w_tuple.instancetypedef) + typedescr = get_typedescr(space.w_tuple.layout.typedef) py_obj = typedescr.allocate(space, space.w_tuple) py_tup = rffi.cast(PyTupleObject, py_obj) 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 @@ -116,7 +116,7 @@ def update_all_slots(space, w_type, pto): # XXX fill slots in pto - typedef = w_type.instancetypedef + typedef = w_type.layout.typedef for method_name, slot_name, slot_names, slot_func in slotdefs_for_tp_slots: w_descr = w_type.lookup(method_name) if w_descr is None: @@ -306,7 +306,7 @@ @bootstrap_function def init_typeobject(space): - make_typedescr(space.w_type.instancetypedef, + make_typedescr(space.w_type.layout.typedef, basestruct=PyTypeObject, alloc=type_alloc, attach=type_attach, @@ -445,7 +445,7 @@ pto = rffi.cast(PyTypeObjectPtr, py_obj) - typedescr = get_typedescr(w_type.instancetypedef) + typedescr = get_typedescr(w_type.layout.typedef) # dealloc pto.c_tp_dealloc = typedescr.get_dealloc(space) @@ -517,7 +517,7 @@ return w_obj def solid_base(space, w_type): - typedef = w_type.instancetypedef + typedef = w_type.layout.typedef return space.gettypeobject(typedef) def best_base(space, bases_w): diff --git a/pypy/module/cpyext/unicodeobject.py b/pypy/module/cpyext/unicodeobject.py --- a/pypy/module/cpyext/unicodeobject.py +++ b/pypy/module/cpyext/unicodeobject.py @@ -27,7 +27,7 @@ @bootstrap_function def init_unicodeobject(space): - make_typedescr(space.w_unicode.instancetypedef, + make_typedescr(space.w_unicode.layout.typedef, basestruct=PyUnicodeObject.TO, attach=unicode_attach, dealloc=unicode_dealloc, @@ -48,7 +48,7 @@ interpreter object. The buffer may be mutated, until unicode_realize() is called. Refcount of the result is 1. """ - typedescr = get_typedescr(space.w_unicode.instancetypedef) + typedescr = get_typedescr(space.w_unicode.layout.typedef) py_obj = typedescr.allocate(space, space.w_unicode) py_uni = rffi.cast(PyUnicodeObject, py_obj) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit