summaryrefslogtreecommitdiffstats
path: root/Objects/moduleobject.c
diff options
context:
space:
mode:
authorNeil Schemenauer <nascheme@enme.ucalgary.ca>2001-08-29 23:54:21 (GMT)
committerNeil Schemenauer <nascheme@enme.ucalgary.ca>2001-08-29 23:54:21 (GMT)
commite83c00efd06dc8380d481f6c5f92d8c274ce6bd2 (patch)
treee3fb442318523f476d521d42826a90f8476b7f6d /Objects/moduleobject.c
parentfd34369ecb5d66e865f212c65926579bf81cf7a5 (diff)
downloadcpython-e83c00efd06dc8380d481f6c5f92d8c274ce6bd2.zip
cpython-e83c00efd06dc8380d481f6c5f92d8c274ce6bd2.tar.gz
cpython-e83c00efd06dc8380d481f6c5f92d8c274ce6bd2.tar.bz2
Use new GC API.
Diffstat (limited to 'Objects/moduleobject.c')
-rw-r--r--Objects/moduleobject.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c
index ba81593..6d91ecc 100644
--- a/Objects/moduleobject.c
+++ b/Objects/moduleobject.c
@@ -19,12 +19,11 @@ PyModule_New(char *name)
{
PyModuleObject *m;
PyObject *nameobj;
- m = PyObject_NEW(PyModuleObject, &PyModule_Type);
+ m = PyObject_GC_New(PyModuleObject, &PyModule_Type);
if (m == NULL)
return NULL;
nameobj = PyString_FromString(name);
m->md_dict = PyDict_New();
- PyObject_GC_Init(m);
if (m->md_dict == NULL || nameobj == NULL)
goto fail;
if (PyDict_SetItemString(m->md_dict, "__name__", nameobj) != 0)
@@ -32,6 +31,7 @@ PyModule_New(char *name)
if (PyDict_SetItemString(m->md_dict, "__doc__", Py_None) != 0)
goto fail;
Py_DECREF(nameobj);
+ PyObject_GC_Track(m);
return (PyObject *)m;
fail:
@@ -146,12 +146,12 @@ module_init(PyModuleObject *m, PyObject *args, PyObject *kw)
static void
module_dealloc(PyModuleObject *m)
{
- PyObject_GC_Fini(m);
+ PyObject_GC_UnTrack(m);
if (m->md_dict != NULL) {
_PyModule_Clear((PyObject *)m);
Py_DECREF(m->md_dict);
}
- PyObject_DEL(PyObject_AS_GC(m));
+ PyObject_GC_Del(m);
}
static PyObject *
@@ -188,7 +188,7 @@ PyTypeObject PyModule_Type = {
PyObject_HEAD_INIT(&PyType_Type)
0, /* ob_size */
"module", /* tp_name */
- sizeof(PyModuleObject) + PyGC_HEAD_SIZE, /* tp_size */
+ sizeof(PyModuleObject), /* tp_size */
0, /* tp_itemsize */
(destructor)module_dealloc, /* tp_dealloc */
0, /* tp_print */
@@ -205,7 +205,7 @@ PyTypeObject PyModule_Type = {
PyObject_GenericGetAttr, /* tp_getattro */
PyObject_GenericSetAttr, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC |
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /* tp_doc */
(traverseproc)module_traverse, /* tp_traverse */