Mercurial > cpython-lru_cache-weakref
diff Objects/object.c @ 37639:bc4fbbb2db30 2.4
Ignore the references to the dummy objects used as deleted keys
in dicts and sets when computing the total number of references.
| author | Armin Rigo <arigo@tunes.org> |
|---|---|
| date | Wed, 12 Apr 2006 17:06:58 +0000 |
| parents | 4808ee62b156 |
| children |
line wrap: on
line diff
--- a/Objects/object.c Wed Apr 12 15:28:52 2006 +0000 +++ b/Objects/object.c Wed Apr 12 17:06:58 2006 +0000 @@ -5,7 +5,20 @@ #ifdef Py_REF_DEBUG long _Py_RefTotal; -#endif +long +_Py_GetRefTotal(void) +{ + PyObject *o; + long total = _Py_RefTotal; + /* ignore the references to the dummy object of the dicts + because they are not reliable and not useful (now that the + hash table code is well-tested) */ + o = _PyDict_Dummy(); + if (o != NULL) + total -= o->ob_refcnt; + return total; +} +#endif /* Py_REF_DEBUG */ int Py_DivisionWarningFlag;
