summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_gc.py
Commit message (Collapse)AuthorAgeFilesLines
* Remove obsolete __static__/__dynamic__ distinction.Tim Peters2001-10-151-11/+3
|
* Enable GC for new-style instances. This touches lots of files, sinceGuido van Rossum2001-10-051-0/+19
| | | | | | | | | | | | | | | | | | | | | | many types were subclassable but had a xxx_dealloc function that called PyObject_DEL(self) directly instead of deferring to self->ob_type->tp_free(self). It is permissible to set tp_free in the type object directly to _PyObject_Del, for non-GC types, or to _PyObject_GC_Del, for GC types. Still, PyObject_DEL was a tad faster, so I'm fearing that our pystone rating is going down again. I'm not sure if doing something like void xxx_dealloc(PyObject *self) { if (PyXxxCheckExact(self)) PyObject_DEL(self); else self->ob_type->tp_free(self); } is any faster than always calling the else branch, so I haven't attempted that -- however those types whose own dealloc is fancier (int, float, unicode) do use this pattern.
* Add Garbage Collection support to new-style classes (not yet to theirGuido van Rossum2001-10-021-7/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | instances). Also added GC support to various auxiliary types: super, property, descriptors, wrappers, dictproxy. (Only type objects have a tp_clear field; the other types are.) One change was necessary to the GC infrastructure. We have statically allocated type objects that don't have a GC header (and can't easily be given one) and heap-allocated type objects that do have a GC header. Giving these different metatypes would be really ugly: I tried, and I had to modify pickle.py, cPickle.c, copy.py, add a new invent a new name for the new metatype and make it a built-in, change affected tests... In short, a mess. So instead, we add a new type slot tp_is_gc, which is a simple Boolean function that determines whether a particular instance has GC headers or not. This slot is only relevant for types that have the (new) GC flag bit set. If the tp_is_gc slot is NULL (by far the most common case), all instances of the type are deemed to have GC headers. This slot is called by the PyObject_IS_GC() macro (which is only used twice, both times in gcmodule.c). I also changed the extern declarations for a bunch of GC-related functions (_PyObject_GC_Del etc.): these always exist but objimpl.h only declared them when WITH_CYCLE_GC was defined, but I needed to be able to reference them without #ifdefs. (When WITH_CYCLE_GC is not defined, they do the same as their non-GC counterparts anyway.)
* The error reporting here was a bit sparse. In verbose mode, the codeGuido van Rossum2001-10-021-30/+24
| | | | | | | | | | in run_test() referenced two non-existent variables, and in non-verbose mode, the tests didn't report the actual number, when it differed from the expected number. Fixed this. Also added an extra call to gc.collect() at the start of test_all(). This will be needed when I check in the changes to add GC to new-style classes.
* Test GC of frame objects.Neil Schemenauer2001-07-121-0/+11
|
* This patch removes all uses of "assert" in the regression test suiteMarc-André Lemburg2001-01-171-3/+3
| | | | | | | and replaces them with a new API verify(). As a result the regression suite will also perform its tests in optimization mode. Written by Marc-Andre Lemburg. Copyright assigned to Guido van Rossum.
* Make reindent.py happy (convert everything to 4-space indents!).Fred Drake2000-10-231-5/+5
|
* - Add test for new SAVEALL debugging flagNeil Schemenauer2000-09-221-31/+92
| | | | | - Use exceptions rather than asserts for failing tests. - Reorganize tests and produce some output if verbose option is set.
* - add a new testNeil Schemenauer2000-09-151-0/+22
| | | | - document some of the tricky tests (hopefully correctly :)
* Neil Schemenauer: GC enable(), disable(), isenabled() interface.Vladimir Marangozov2000-08-061-0/+12
| | | | | | Small stylistic changes by VM: - is_enabled() -> isenabled() - static ... Py_<func> -> static ... gc_<func>
* remove all prints (since the prints where of memory locations)Jeremy Hylton2000-06-301-13/+0
|
* final patches from Neil Schemenauer for garbage collectionJeremy Hylton2000-06-301-0/+100