* Migrate set() and frozenset() from the sandbox.
* 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.
Thomas Heller [Fri, 14 Nov 2003 10:28:42 +0000 (10:28 +0000)]
SF #841977 - modulefinder fails to find extension modules in packages
The find_all_submodules() method in modulefinder only
looks for *.py, *.pyc, and *.pyo files. Python
extension modules are only found if they are referenced
in import statements somewhere.
This patch uses the actual list from imp.get_suffixes().
Tim Peters [Fri, 14 Nov 2003 00:01:17 +0000 (00:01 +0000)]
update_refs(): assert that incoming refcounts aren't 0. The comment
for this function has always claimed that was true, but it wasn't
verified before. For the latest batch of "double deallocation" bugs
(stemming from weakref callbacks invoked by way of subtype_dealloc),
this assert would have triggered (instead of waiting for
_Py_ForgetReference to die with a segfault later).
Tim Peters [Thu, 13 Nov 2003 22:50:00 +0000 (22:50 +0000)]
subtype_dealloc(): Simplified overly contorted retracking logic. With
this change, I think subtype_dealloc is actually a smidgen less obscure
than it was in 2.3 -- we got rid of a negation in an "if" <wink>.
Tim Peters [Wed, 12 Nov 2003 20:43:28 +0000 (20:43 +0000)]
SF bug 840829: weakref callbacks and gc corrupt memory.
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.
Tim Peters [Wed, 12 Nov 2003 19:30:36 +0000 (19:30 +0000)]
pyexpat stopped building on Windows -- whining about the lack of a
HAVE_MEMMOVE define. Just defined it on the cmdline (it doesn't
include Python.h, and Fred doesn't want to change the code).
Guido van Rossum [Mon, 10 Nov 2003 02:16:36 +0000 (02:16 +0000)]
mktemp() shouldn't rely on os.path.exists(), which can return False if
the file is a symlink. Instead, use os.lstat directly, if it exists;
fall back on os.stat or the built-in open. Thanks to Iustin Pop.
Alex Martelli [Sun, 9 Nov 2003 16:33:56 +0000 (16:33 +0000)]
clarified (in the 5.14 summary) that tests and comparisons all chain,
added a specific \ref to 5.9 in lieu of previous vague "see above".
(same as commit of Sun Nov 2 to the release23-maint branch)
* Use weakref's of DBCursor objects for the iterator cursors to avoid a
memory leak that would've occurred for all iterators that were
destroyed before having iterated until they raised StopIteration.
* Simplify some code.
* Add new test cases to check for the memleak and ensure that mixing
iteration with modification of the values for existing keys works.
* Fix the singlethreaded deadlocks occurring in the simple bsddb interface.
* Add support for multiple iterator/generator objects at once on the simple
bsddb _DBWithCursor interface.
Fix a tuple memory leak when raising DB, DBEnv and DBCursor "object
has been closed" exceptions.
Adds a DBCursorClosedError exception in the closed cursor case for
future use in fixing the legacy bsddb interface deadlock problems
due to its use of cursors with DB_INIT_LOCK | DB_THREAD support
enabled.
* tee object is no longer subclassable
* independent iterators renamed to "itertools.tee_iterator"
* fixed doc string typo and added entry in the module doc string
Steve Purcell [Sun, 26 Oct 2003 10:41:03 +0000 (10:41 +0000)]
Incorporated patch 819077, from George Yoshida:
* Fixed typo in docstring for 'failUnlessAlmostEqual()'
* Removed unnecessary use of 'float()' for time values.
* Removed apparently unnecessary import of unittest. At some point in
the distant past I believe it was necessary otherwise the 'TestCase'
that a module saw was not the same as the 'TestCase' seen within
'unittest', and the user's TestCase subclasses were not recognised as
subclasses of the TestCase seen within unittest. Seems not to be
necessary now.