summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_gc.py
Commit message (Collapse)AuthorAgeFilesLines
* test_saveall(): Another small simplification; plus s/l/L/g.Tim Peters2002-08-111-10/+8
| | | | test_del(), test_del_newclass(): No need to use apply() in these.
* And one more simplification to test_saveall().Tim Peters2002-08-101-11/+10
|
* test_saveall(): Simplified a little, given that we only expect one itemTim Peters2002-08-101-6/+4
| | | | | in gc.garbage (so no need to loop looking for it -- it's there or it's not).
* If any trash happened to be sitting around waiting to get collected atTim Peters2002-08-101-1/+8
| | | | | the time it's called, test_saveall() made it look a leak, triggering bogus warnings from regrtest's -l (findleaks) mode.
* Test finalizers and GC from inside __del__ for new classes.Guido van Rossum2002-08-091-0/+41
|
* Get rid of relative imports in all unittests. Now anything thatBarry Warsaw2002-07-231-1/+1
| | | | | | | | | | | imports e.g. test_support must do so using an absolute package name such as "import test.test_support" or "from test import test_support". This also updates the README in Lib/test, and gets rid of the duplicate data dirctory in Lib/test/data (replaced by Lib/email/test/data). Now Tim and Jack can have at it. :)
* test_trashcan() and supporting class Ouch(): Jeremy noted that this testTim Peters2002-07-111-3/+9
| | | | | | | | | | | | | | takes much longer to run in the context of the test suite than when run in isolation. That's because it forces a large number of full collections, which take time proportional to the total number of gc'ed objects in the whole system. But since the dangerous implementation trickery that caused this test to fail in 2.0, 2.1 and 2.2 doesn't exist in 2.3 anymore (the trashcan mechanism stopped doing evil things when the possibility for compiling without cyclic gc was taken away), such an expensive test is no longer justified. This checkin leaves the test intact, but fiddles the constants to reduce the runtime by about a factor of 5.
* Whitespace nit.Guido van Rossum2002-06-131-1/+1
|
* Add a testcase to ensure that cycles going through the __class__ linkGuido van Rossum2002-06-121-0/+6
| | | | of a new-style instance are detected by the garbage collector.
* test_trashcan: reword obscure code.Tim Peters2002-03-281-1/+1
| | | | Bugfix candidate.
* New test_traschcan() test in test_gc, which reliably provokes segfaultsTim Peters2002-03-281-0/+29
| | | | | | under 2.0, 2.1 and 2.2. Bugfix candidate.
* 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