summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_weakref.py
Commit message (Collapse)AuthorAgeFilesLines
* SF bug 839548: Bug in type's GC handling causes segfaults.Tim Peters2003-11-201-0/+205
| | | | | | | | Also SF patch 843455. This is a critical bugfix. I'll backport to 2.3 maint, but not beyond that. The bugs this fixes have been there since weakrefs were introduced.
* * Migrate set() and frozenset() from the sandbox.Raymond Hettinger2003-11-161-2/+1
| | | | | | | | * Install the unittests, docs, newsitem, include file, and makefile update. * Exercise the new functions whereever sets.py was being used. Includes the docs for libfuncs.tex. Separate docs for the types are forthcoming.
* subtype_dealloc(): A more complete fix for critical bug 840829 +Tim Peters2003-11-131-0/+19
| | | | | | expanded the test case with a piece that needs the more-complete fix. I'll backport this to 2.3 maint.
* SF bug 840829: weakref callbacks and gc corrupt memory.Tim Peters2003-11-121-0/+20
| | | | | | | | | | | | | | | | | subtype_dealloc(): This left the dying object exposed to gc, so that if cyclic gc triggered during the weakref callback, gc tried to delete the dying object a second time. That's a disaster. subtype_dealloc() had a (I hope!) unique problem here, as every normal dealloc routine untracks the object (from gc) before fiddling with weakrefs etc. But subtype_dealloc has obscure technical reasons for re-registering the dying object with gc (already explained in a large comment block at the bottom of the function). The fix amounts to simply refraining from reregistering the dying object with gc until after the weakref callback (if any) has been called. This is a critical bug (hard to predict, and causes seemingly random memory corruption when it occurs). I'll backport it to 2.3 later.
* stylistic nits:Fred Drake2003-07-141-6/+8
| | | | | | - wrap some long lines - shorten others - fix indentation
* Fix SF 762891: "del p[key]" on proxy object raises SystemError()Raymond Hettinger2003-06-301-0/+11
|
* Fleshed out WeakKeyDictionary.__delitem__ NEWS to cover issues raised onTim Peters2003-05-251-2/+10
| | | | | | | | | Python-Dev. Fixed typos in test comments. Added some trivial new test guts to show the parallelism (now) among __delitem__, __setitem__ and __getitem__ wrt error conditions. Still a bugfix candidate for 2.2.3 final, but waiting for Fred to get a chance to chime in.
* SF 742860: WeakKeyDictionary __delitem__ uses iterkeysTim Peters2003-05-251-0/+51
| | | | | | | | | | | | | | | | | Someone review this, please! Final releases are getting close, Fred (the weakref guy) won't be around until Tuesday, and the pre-patch code can indeed raise spurious RuntimeErrors in the presence of threads or mutating comparison functions. See the bug report for my confusions: I can't see any reason for why __delitem__ iterated over the keys. The new one-liner implementation is much faster, can't raise RuntimeError, and should be better-behaved in all respects wrt threads. New tests test_weak_keyed_bad_delitem and test_weak_keyed_cascading_deletes fail before this patch. Bugfix candidate for 2.2.3 too, if someone else agrees with this patch.
* Used sets.Set() to compare unordered sequences.Raymond Hettinger2003-05-021-3/+2
| | | | Improves clarity and brevity.
* Combine the functionality of test_support.run_unittest()Walter Dörwald2003-05-011-6/+6
| | | | | | | | | | and test_support.run_classtests() into run_unittest() and use it wherever possible. Also don't use "from test.test_support import ...", but "from test import test_support" in a few spots. From SF patch #662807.
* SF patch #667730: More DictMixinRaymond Hettinger2003-03-091-0/+17
| | | | | | | | * Adds missing pop() methods to weakref.py * Expands test suite to broaden coverage of objects with a mapping interface. Contributed by Sebastien Keim.
* Standardize behavior: no docstrings in test functions. Also useGuido van Rossum2002-08-221-6/+4
| | | | unittest.makeSuite() rather than loader.loadTestsFromTestCase().
* 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. :)
* SF patch 564549 (Erik Andersén).Guido van Rossum2002-06-101-0/+11
| | | | | | | The WeakKeyDictionary constructor didn't work when a dict arg was given. Fixed by moving a line. Also adding a unit test. Bugfix candidate.
* Improve coverage of Objects/weakrefobject.c.Fred Drake2002-04-111-0/+16
|
* Add some additional tests that check more proxy behaviors.Fred Drake2001-12-191-0/+18
|
* Regression test for SF bug #478534 -- exceptions could "leak" into a weakrefFred Drake2001-12-101-0/+25
| | | | callback.
* Add a regression test for SF bug #478536: If a value cannot be weaklyFred Drake2001-11-061-1/+5
| | | | | referenced, WeakKeyDictionary.has_key() should return 0 instead of raising TypeError.
* Add a test for calling a weakref proxy with a dictionary of keyword args.Fred Drake2001-10-181-0/+3
|
* Make sure we do not core dump when using proxies with the binary slotFred Drake2001-10-181-0/+8
| | | | handlers. This was fixed in Objects/weakrefobject.c 1.2.
* Change the PyUnit-based tests to use the test_main() approach. ThisFred Drake2001-09-201-3/+11
| | | | | allows using the tests with unittest.py as a script. The tests will still run when run as a script themselves.
* Added tests for key deletion for both Weak*Dictionary flavors.Fred Drake2001-09-061-0/+22
| | | | This covers regression on SF bug #458860.
* Make sure that WeakValueDictionary[] raises KeyError instead of TypeErrorFred Drake2001-08-031-0/+5
| | | | for keys that are not in the dictionary.
* Extend the weakref test suite to cover the complete mapping interface forFred Drake2001-05-101-4/+61
| | | | | | both weakref.Weak*Dictionary classes. This closes SF bug #416480.
* Added tests for Weak*Dictionary iterator support.Fred Drake2001-05-021-10/+54
| | | | Refactored some object initialization to be more reusable.
* Add a test case for Weak*Dictionary.update() that would have caught aFred Drake2001-04-161-0/+25
| | | | recently reported bug; also exposed some other bugs in the implementation.
* Added regression test for SF bug #415660 (failure to invalidate allFred Drake2001-04-131-5/+24
| | | | | | references to an object before calling registered callbacks). Change last uses of verify() to self.assert_().
* Use the WeakKeyDictionary and WeakValueDictionary classes directlyFred Drake2001-04-101-2/+2
| | | | instead of using the mapping() function.
* Convert the weakref test suite to PyUNIT, and add tests that exercise weakFred Drake2001-03-231-236/+252
| | | | references on function objects and both bound and unbound methods.
* Add tests for the .copy() methods of both weak dictionary classes.Fred Drake2001-03-011-1/+15
|
* Patch #403985: Add support for weak-keyed dictionariesMartin v. Löwis2001-02-271-0/+18
|
* PEP 205, Weak References -- initial checkin.Fred Drake2001-02-011-0/+218