Skip to content

Commit fd34369

Browse files
committed
Remove GC related code. It lives in gcmodule now.
1 parent 4f4817f commit fd34369

File tree

1 file changed

+1
-26
lines changed

1 file changed

+1
-26
lines changed

Objects/object.c

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ PyObject_Init(PyObject *op, PyTypeObject *tp)
9393
"NULL object passed to PyObject_Init");
9494
return op;
9595
}
96-
if (PyType_IS_GC(tp))
97-
op = (PyObject *) PyObject_FROM_GC(op);
9896
/* Any changes should be reflected in PyObject_INIT (objimpl.h) */
9997
op->ob_type = tp;
10098
_Py_NewReference(op);
@@ -109,8 +107,6 @@ PyObject_InitVar(PyVarObject *op, PyTypeObject *tp, int size)
109107
"NULL object passed to PyObject_InitVar");
110108
return op;
111109
}
112-
if (PyType_IS_GC(tp))
113-
op = (PyVarObject *) PyObject_FROM_GC(op);
114110
/* Any changes should be reflected in PyObject_INIT_VAR */
115111
op->ob_size = size;
116112
op->ob_type = tp;
@@ -125,8 +121,6 @@ _PyObject_New(PyTypeObject *tp)
125121
op = (PyObject *) PyObject_MALLOC(_PyObject_SIZE(tp));
126122
if (op == NULL)
127123
return PyErr_NoMemory();
128-
if (PyType_IS_GC(tp))
129-
op = (PyObject *) PyObject_FROM_GC(op);
130124
return PyObject_INIT(op, tp);
131125
}
132126

@@ -137,26 +131,15 @@ _PyObject_NewVar(PyTypeObject *tp, int size)
137131
op = (PyVarObject *) PyObject_MALLOC(_PyObject_VAR_SIZE(tp, size));
138132
if (op == NULL)
139133
return (PyVarObject *)PyErr_NoMemory();
140-
if (PyType_IS_GC(tp))
141-
op = (PyVarObject *) PyObject_FROM_GC(op);
142134
return PyObject_INIT_VAR(op, tp, size);
143135
}
144136

145137
void
146138
_PyObject_Del(PyObject *op)
147139
{
148-
if (op && PyType_IS_GC(op->ob_type)) {
149-
op = (PyObject *) PyObject_AS_GC(op);
150-
}
151140
PyObject_FREE(op);
152141
}
153142

154-
#ifndef WITH_CYCLE_GC
155-
/* extension modules might need these */
156-
void _PyGC_Insert(PyObject *op) { }
157-
void _PyGC_Remove(PyObject *op) { }
158-
#endif
159-
160143
int
161144
PyObject_Print(PyObject *op, FILE *fp, int flags)
162145
{
@@ -215,14 +198,6 @@ void _PyObject_Dump(PyObject* op)
215198
}
216199
}
217200

218-
#ifdef WITH_CYCLE_GC
219-
void _PyGC_Dump(PyGC_Head* op)
220-
{
221-
_PyObject_Dump(PyObject_FROM_GC(op));
222-
}
223-
#endif /* WITH_CYCLE_GC */
224-
225-
226201
PyObject *
227202
PyObject_Repr(PyObject *v)
228203
{
@@ -1146,7 +1121,7 @@ _PyObject_GetDictPtr(PyObject *obj)
11461121
if (dictoffset == 0)
11471122
return NULL;
11481123
if (dictoffset < 0) {
1149-
dictoffset += PyType_BASICSIZE(tp);
1124+
dictoffset += tp->tp_basicsize;
11501125
assert(dictoffset > 0); /* Sanity check */
11511126
if (tp->tp_itemsize > 0) {
11521127
int n = ((PyVarObject *)obj)->ob_size;

0 commit comments

Comments
 (0)