comparison 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
comparison
equal deleted inserted replaced
45024:f062dda54894 45025:ea3fe302d392
752 8. generator calls\n\ 752 8. generator calls\n\
753 9. All other calls\n\ 753 9. All other calls\n\
754 10. Number of stack pops performed by call_function()" 754 10. Number of stack pops performed by call_function()"
755 ); 755 );
756 756
757 static PyObject *
758 sys_cleartypecache(PyObject* self, PyObject* args)
759 {
760 PyType_ClearCache();
761 Py_RETURN_NONE;
762 }
763
764 PyDoc_STRVAR(cleartypecache_doc,
765 "_cleartypecache() -> None\n\
766 Clear the internal type lookup cache.");
767
757 #ifdef __cplusplus 768 #ifdef __cplusplus
758 extern "C" { 769 extern "C" {
759 #endif 770 #endif
760 771
761 #ifdef Py_TRACE_REFS 772 #ifdef Py_TRACE_REFS
774 785
775 static PyMethodDef sys_methods[] = { 786 static PyMethodDef sys_methods[] = {
776 /* Might as well keep this in alphabetic order */ 787 /* Might as well keep this in alphabetic order */
777 {"callstats", (PyCFunction)PyEval_GetCallStats, METH_NOARGS, 788 {"callstats", (PyCFunction)PyEval_GetCallStats, METH_NOARGS,
778 callstats_doc}, 789 callstats_doc},
790 {"_cleartypecache", sys_cleartypecache, METH_NOARGS,
791 cleartypecache_doc},
779 {"_current_frames", sys_current_frames, METH_NOARGS, 792 {"_current_frames", sys_current_frames, METH_NOARGS,
780 current_frames_doc}, 793 current_frames_doc},
781 {"displayhook", sys_displayhook, METH_O, displayhook_doc}, 794 {"displayhook", sys_displayhook, METH_O, displayhook_doc},
782 {"exc_info", sys_exc_info, METH_NOARGS, exc_info_doc}, 795 {"exc_info", sys_exc_info, METH_NOARGS, exc_info_doc},
783 {"exc_clear", sys_exc_clear, METH_NOARGS, exc_clear_doc}, 796 {"exc_clear", sys_exc_clear, METH_NOARGS, exc_clear_doc},