Mercurial > cpython-lru_cache-weakref
diff Python/sysmodule.c @ 45025:ea3fe302d392 legacy-trunk
Added clear cache methods to clear the internal type lookup cache for ref leak test runs.
| author | Christian Heimes <christian@cheimes.de> |
|---|---|
| date | Sun, 27 Jan 2008 23:34:59 +0000 |
| parents | 424cccfd2baa |
| children | 9639a73afa47 |
line wrap: on
line diff
--- a/Python/sysmodule.c Sun Jan 27 23:08:46 2008 +0000 +++ b/Python/sysmodule.c Sun Jan 27 23:34:59 2008 +0000 @@ -754,6 +754,17 @@ 10. Number of stack pops performed by call_function()" ); +static PyObject * +sys_cleartypecache(PyObject* self, PyObject* args) +{ + PyType_ClearCache(); + Py_RETURN_NONE; +} + +PyDoc_STRVAR(cleartypecache_doc, +"_cleartypecache() -> None\n\ +Clear the internal type lookup cache."); + #ifdef __cplusplus extern "C" { #endif @@ -776,6 +787,8 @@ /* Might as well keep this in alphabetic order */ {"callstats", (PyCFunction)PyEval_GetCallStats, METH_NOARGS, callstats_doc}, + {"_cleartypecache", sys_cleartypecache, METH_NOARGS, + cleartypecache_doc}, {"_current_frames", sys_current_frames, METH_NOARGS, current_frames_doc}, {"displayhook", sys_displayhook, METH_O, displayhook_doc},
