1360: #line 1586 "mxTools.pak"
1361:
1362: Py_C_Function( mxTools_sizeof,
1363: "sizeof(object)\n\n"
1364: "Returns the size in memory of the object in bytes.\n"
1365: "Note that this doesn't show any extra space allocated by\n"
1366: "the object.")
1367: {
1368: int size;
1369: register PyObject *w;
1370: PyTypeObject *t;
1371:
1372: Py_GetArgObject(w);
1373: t = w->ob_type;
1374: size = t->tp_basicsize;
1375: if (t->tp_itemsize)
1376: size += t->tp_itemsize * ((PyVarObject *)w)->ob_size;
1377:
1378: return PyInt_FromLong((long)size);
1379: onError:
1380: return NULL;
1381: }
1382: