comparison Python/sysmodule.c @ 47897:0738119c1ef8 legacy-trunk

- Issue #2862: Make int and float freelist management consistent with other freelists. Changes their CompactFreeList apis into ClearFreeList apis and calls them via gc.collect().
author Gregory P. Smith <greg@mad-scientist.com>
date Sun, 06 Jul 2008 03:35:58 +0000
parents 52294af4b663
children 68c7964d2534
comparison
equal deleted inserted replaced
47896:45b672367b1f 47897:0738119c1ef8
827 PyDoc_STRVAR(sys_clear_type_cache__doc__, 827 PyDoc_STRVAR(sys_clear_type_cache__doc__,
828 "_clear_type_cache() -> None\n\ 828 "_clear_type_cache() -> None\n\
829 Clear the internal type lookup cache."); 829 Clear the internal type lookup cache.");
830 830
831 831
832 static PyObject *
833 sys_compact_freelists(PyObject* self, PyObject* args)
834 {
835 size_t isum, ibc, ibf;
836 size_t fsum, fbc, fbf;
837
838 PyInt_CompactFreeList(&ibc, &ibf, &isum);
839 PyFloat_CompactFreeList(&fbc, &fbf, &fsum);
840
841 return Py_BuildValue("(kkk)(kkk)", isum, ibc, ibf,
842 fsum, fbc, fbf);
843
844 }
845
846 PyDoc_STRVAR(sys_compact_freelists__doc__,
847 "_compact_freelists() -> ((remaing_objects, total_blocks, freed_blocks), ...)\n\
848 Compact the free lists of ints and floats.");
849
850 static PyMethodDef sys_methods[] = { 832 static PyMethodDef sys_methods[] = {
851 /* Might as well keep this in alphabetic order */ 833 /* Might as well keep this in alphabetic order */
852 {"callstats", (PyCFunction)PyEval_GetCallStats, METH_NOARGS, 834 {"callstats", (PyCFunction)PyEval_GetCallStats, METH_NOARGS,
853 callstats_doc}, 835 callstats_doc},
854 {"_clear_type_cache", sys_clear_type_cache, METH_NOARGS, 836 {"_clear_type_cache", sys_clear_type_cache, METH_NOARGS,
855 sys_clear_type_cache__doc__}, 837 sys_clear_type_cache__doc__},
856 {"_compact_freelists", sys_compact_freelists, METH_NOARGS,
857 sys_compact_freelists__doc__},
858 {"_current_frames", sys_current_frames, METH_NOARGS, 838 {"_current_frames", sys_current_frames, METH_NOARGS,
859 current_frames_doc}, 839 current_frames_doc},
860 {"displayhook", sys_displayhook, METH_O, displayhook_doc}, 840 {"displayhook", sys_displayhook, METH_O, displayhook_doc},
861 {"exc_info", sys_exc_info, METH_NOARGS, exc_info_doc}, 841 {"exc_info", sys_exc_info, METH_NOARGS, exc_info_doc},
862 {"exc_clear", sys_exc_clear, METH_NOARGS, exc_clear_doc}, 842 {"exc_clear", sys_exc_clear, METH_NOARGS, exc_clear_doc},