comparison Python/sysmodule.c @ 24126:fdf80e04e4bb legacy-trunk

Rearranged and added comments to object.h, to clarify many things that have taken me "too long" to reverse-engineer over the years. Vastly reduced the nesting level and redundancy of #ifdef-ery. Took a light stab at repairing comments that are no longer true. sys_gettotalrefcount(): Changed to enable under Py_REF_DEBUG. It was enabled under Py_TRACE_REFS, which was much heavier than necessary. sys.gettotalrefcount() is now available in a Py_REF_DEBUG-only build.
author Tim Peters <tim.peters@gmail.com>
date Sun, 07 Jul 2002 19:59:50 +0000
parents 8142f8d668a0
children a69a12484d69
comparison
equal deleted inserted replaced
24125:f38112b88388 24126:fdf80e04e4bb
467 sys_getrefcount(PyObject *self, PyObject *arg) 467 sys_getrefcount(PyObject *self, PyObject *arg)
468 { 468 {
469 return PyInt_FromLong(arg->ob_refcnt); 469 return PyInt_FromLong(arg->ob_refcnt);
470 } 470 }
471 471
472 #ifdef Py_TRACE_REFS 472 #ifdef Py_REF_DEBUG
473 static PyObject * 473 static PyObject *
474 sys_gettotalrefcount(PyObject *self) 474 sys_gettotalrefcount(PyObject *self)
475 { 475 {
476 extern long _Py_RefTotal;
477 return PyInt_FromLong(_Py_RefTotal); 476 return PyInt_FromLong(_Py_RefTotal);
478 } 477 }
479 478
480 #endif /* Py_TRACE_REFS */ 479 #endif /* Py_TRACE_REFS */
481 480
562 #ifdef DYNAMIC_EXECUTION_PROFILE 561 #ifdef DYNAMIC_EXECUTION_PROFILE
563 {"getdxp", _Py_GetDXProfile, METH_VARARGS}, 562 {"getdxp", _Py_GetDXProfile, METH_VARARGS},
564 #endif 563 #endif
565 #ifdef Py_TRACE_REFS 564 #ifdef Py_TRACE_REFS
566 {"getobjects", _Py_GetObjects, METH_VARARGS}, 565 {"getobjects", _Py_GetObjects, METH_VARARGS},
566 #endif
567 #ifdef Py_REF_DEBUG
567 {"gettotalrefcount", (PyCFunction)sys_gettotalrefcount, METH_NOARGS}, 568 {"gettotalrefcount", (PyCFunction)sys_gettotalrefcount, METH_NOARGS},
568 #endif 569 #endif
569 {"getrefcount", (PyCFunction)sys_getrefcount, METH_O, getrefcount_doc}, 570 {"getrefcount", (PyCFunction)sys_getrefcount, METH_O, getrefcount_doc},
570 {"getrecursionlimit", (PyCFunction)sys_getrecursionlimit, METH_NOARGS, 571 {"getrecursionlimit", (PyCFunction)sys_getrecursionlimit, METH_NOARGS,
571 getrecursionlimit_doc}, 572 getrecursionlimit_doc},