diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2007-07-21 17:22:18 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2007-07-21 17:22:18 (GMT) |
commit | 9f2e346911988cda95fec7c901e8d10d34fa9563 (patch) | |
tree | 1632c78fb8e18b2f789102451bedd15996bff6c5 /Modules/gcmodule.c | |
parent | b972a78e17beeb997d809d87f2e422e6622efd52 (diff) | |
download | cpython-9f2e346911988cda95fec7c901e8d10d34fa9563.zip cpython-9f2e346911988cda95fec7c901e8d10d34fa9563.tar.gz cpython-9f2e346911988cda95fec7c901e8d10d34fa9563.tar.bz2 |
Merged revisions 56467-56482 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk
................
r56477 | martin.v.loewis | 2007-07-21 09:04:38 +0200 (Sa, 21 Jul 2007) | 11 lines
Merged revisions 56466-56476 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r56476 | martin.v.loewis | 2007-07-21 08:55:02 +0200 (Sa, 21 Jul 2007) | 4 lines
PEP 3123: Provide forward compatibility with Python 3.0, while keeping
backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and
PyVarObject_HEAD_INIT.
........
................
r56478 | martin.v.loewis | 2007-07-21 09:47:23 +0200 (Sa, 21 Jul 2007) | 2 lines
PEP 3123: Use proper C inheritance for PyObject.
................
r56479 | martin.v.loewis | 2007-07-21 10:06:55 +0200 (Sa, 21 Jul 2007) | 3 lines
Add longintrepr.h to Python.h, so that the compiler can
see that PyFalse is really some kind of PyObject*.
................
r56480 | martin.v.loewis | 2007-07-21 10:47:18 +0200 (Sa, 21 Jul 2007) | 2 lines
Qualify SHIFT, MASK, BASE.
................
r56482 | martin.v.loewis | 2007-07-21 19:10:57 +0200 (Sa, 21 Jul 2007) | 2 lines
Correctly refer to _ob_next.
................
Diffstat (limited to 'Modules/gcmodule.c')
-rw-r--r-- | Modules/gcmodule.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index adcdb5f..5960730 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -237,7 +237,7 @@ update_refs(PyGC_Head *containers) PyGC_Head *gc = containers->gc.gc_next; for (; gc != containers; gc = gc->gc.gc_next) { assert(gc->gc.gc_refs == GC_REACHABLE); - gc->gc.gc_refs = FROM_GC(gc)->ob_refcnt; + gc->gc.gc_refs = Py_Refcnt(FROM_GC(gc)); /* Python's cyclic gc should never see an incoming refcount * of 0: if something decref'ed to 0, it should have been * deallocated immediately at that time. @@ -289,7 +289,7 @@ subtract_refs(PyGC_Head *containers) traverseproc traverse; PyGC_Head *gc = containers->gc.gc_next; for (; gc != containers; gc=gc->gc.gc_next) { - traverse = FROM_GC(gc)->ob_type->tp_traverse; + traverse = Py_Type(FROM_GC(gc))->tp_traverse; (void) traverse(FROM_GC(gc), (visitproc)visit_decref, NULL); @@ -374,7 +374,7 @@ move_unreachable(PyGC_Head *young, PyGC_Head *unreachable) * the next object to visit. */ PyObject *op = FROM_GC(gc); - traverseproc traverse = op->ob_type->tp_traverse; + traverseproc traverse = Py_Type(op)->tp_traverse; assert(gc->gc.gc_refs > 0); gc->gc.gc_refs = GC_REACHABLE; (void) traverse(op, @@ -464,7 +464,7 @@ move_finalizer_reachable(PyGC_Head *finalizers) PyGC_Head *gc = finalizers->gc.gc_next; for (; gc != finalizers; gc = gc->gc.gc_next) { /* Note that the finalizers list may grow during this. */ - traverse = FROM_GC(gc)->ob_type->tp_traverse; + traverse = Py_Type(FROM_GC(gc))->tp_traverse; (void) traverse(FROM_GC(gc), (visitproc)visit_move, (void *)finalizers); @@ -509,7 +509,7 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old) assert(IS_TENTATIVELY_UNREACHABLE(op)); next = gc->gc.gc_next; - if (! PyType_SUPPORTS_WEAKREFS(op->ob_type)) + if (! PyType_SUPPORTS_WEAKREFS(Py_Type(op))) continue; /* It supports weakrefs. Does it have any? */ @@ -629,7 +629,7 @@ debug_cycle(char *msg, PyObject *op) { if (debug & DEBUG_OBJECTS) { PySys_WriteStderr("gc: %.100s <%.100s %p>\n", - msg, op->ob_type->tp_name, op); + msg, Py_Type(op)->tp_name, op); } } @@ -683,7 +683,7 @@ delete_garbage(PyGC_Head *collectable, PyGC_Head *old) PyList_Append(garbage, op); } else { - if ((clear = op->ob_type->tp_clear) != NULL) { + if ((clear = Py_Type(op)->tp_clear) != NULL) { Py_INCREF(op); clear(op); Py_DECREF(op); @@ -1053,7 +1053,7 @@ gc_referrers_for(PyObject *objs, PyGC_Head *list, PyObject *resultlist) traverseproc traverse; for (gc = list->gc.gc_next; gc != list; gc = gc->gc.gc_next) { obj = FROM_GC(gc); - traverse = obj->ob_type->tp_traverse; + traverse = Py_Type(obj)->tp_traverse; if (obj == objs || obj == resultlist) continue; if (traverse(obj, (visitproc)referrersvisit, objs)) { @@ -1110,7 +1110,7 @@ gc_get_referents(PyObject *self, PyObject *args) if (! PyObject_IS_GC(obj)) continue; - traverse = obj->ob_type->tp_traverse; + traverse = Py_Type(obj)->tp_traverse; if (! traverse) continue; if (traverse(obj, (visitproc)referentsvisit, result)) { @@ -1332,13 +1332,13 @@ _PyObject_GC_NewVar(PyTypeObject *tp, Py_ssize_t nitems) PyVarObject * _PyObject_GC_Resize(PyVarObject *op, Py_ssize_t nitems) { - const size_t basicsize = _PyObject_VAR_SIZE(op->ob_type, nitems); + const size_t basicsize = _PyObject_VAR_SIZE(Py_Type(op), nitems); PyGC_Head *g = AS_GC(op); g = (PyGC_Head *)PyObject_REALLOC(g, sizeof(PyGC_Head) + basicsize); if (g == NULL) return (PyVarObject *)PyErr_NoMemory(); op = (PyVarObject *) FROM_GC(g); - op->ob_size = nitems; + Py_Size(op) = nitems; return op; } |