[Python-checkins] r63521 - in python/branches/okkoto-sizeof/Python: bltinmodule.c sysmodule.c

robert.schuppenies python-checkins at python.org
Wed May 21 17:31:29 CEST 2008


Author: robert.schuppenies
Date: Wed May 21 17:31:20 2008
New Revision: 63521

Log:
moved builtin footprint() to sys.sizeof()


Modified:
   python/branches/okkoto-sizeof/Python/bltinmodule.c
   python/branches/okkoto-sizeof/Python/sysmodule.c

Modified: python/branches/okkoto-sizeof/Python/bltinmodule.c
==============================================================================
--- python/branches/okkoto-sizeof/Python/bltinmodule.c	(original)
+++ python/branches/okkoto-sizeof/Python/bltinmodule.c	Wed May 21 17:31:20 2008
@@ -1310,21 +1310,6 @@
 \n\
 Return the number of items of a sequence or mapping.");
 
-static PyObject *
-builtin_footprint(PyObject *self, PyObject *o)
-{
-	Py_ssize_t res;
-              
-	res = PyObject_Footprint(o);
-	if (res < 0 && PyErr_Occurred())
-		return NULL;
-	return PyInt_FromSsize_t(res);
-}
-
-PyDoc_STRVAR(footprint_doc,
-"footprint(object) -> integer\n\
-\n\
-Return the memory footprint an object in bytes.");
 
 static PyObject *
 builtin_locals(PyObject *self)
@@ -2565,7 +2550,6 @@
  	{"issubclass",  builtin_issubclass, METH_VARARGS, issubclass_doc},
  	{"iter",	builtin_iter,       METH_VARARGS, iter_doc},
  	{"len",		builtin_len,        METH_O, len_doc},
- 	{"footprint",	builtin_footprint,  METH_O, footprint_doc},
  	{"locals",	(PyCFunction)builtin_locals,     METH_NOARGS, locals_doc},
  	{"map",		builtin_map,        METH_VARARGS, map_doc},
  	{"max",		(PyCFunction)builtin_max,        METH_VARARGS | METH_KEYWORDS, max_doc},

Modified: python/branches/okkoto-sizeof/Python/sysmodule.c
==============================================================================
--- python/branches/okkoto-sizeof/Python/sysmodule.c	(original)
+++ python/branches/okkoto-sizeof/Python/sysmodule.c	Wed May 21 17:31:20 2008
@@ -640,6 +640,24 @@
 #endif /* USE_MALLOPT */
 
 static PyObject *
+sys_sizeof(PyObject *self, PyObject *o)
+{
+	Py_ssize_t res;
+              
+	res = PyObject_Footprint(o);
+	if (res < 0 && PyErr_Occurred())
+		return NULL;
+	return PyInt_FromSsize_t(res);
+}
+
+PyDoc_STRVAR(sizeof_doc,
+"sizeof(object) -> integer\n\
+\n\
+Return the memory footprint of an object in bytes.");
+
+
+
+static PyObject *
 sys_getrefcount(PyObject *self, PyObject *arg)
 {
 	return PyInt_FromSsize_t(arg->ob_refcnt);
@@ -880,6 +898,7 @@
 	{"settrace",	sys_settrace, METH_O, settrace_doc},
 	{"gettrace",	sys_gettrace, METH_NOARGS, gettrace_doc},
 	{"call_tracing", sys_call_tracing, METH_VARARGS, call_tracing_doc},
+ 	{"sizeof",	sys_sizeof,  METH_O, sizeof_doc},
 	{NULL,		NULL}		/* sentinel */
 };
 


More information about the Python-checkins mailing list