Commit Graph

28976 Commits

Author SHA1 Message Date
Tim Peters 780c497972 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).
2003-11-14 00:01:17 +00:00
Tim Peters 0bd743cee1 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>.
2003-11-13 22:50:00 +00:00
Tim Peters f7f9e9966b subtype_dealloc(): A more complete fix for critical bug 840829 +
expanded the test case with a piece that needs the more-complete fix.

I'll backport this to 2.3 maint.
2003-11-13 21:59:32 +00:00
Andrew M. Kuchling 981a918575 Various edits 2003-11-13 21:33:26 +00:00
Gregory P. Smith b845ef056a remove "support" for BerkeleyDB 3.1, it hasn't worked for a long time 2003-11-13 08:30:03 +00:00
Martin v. Löwis d4e48b7f61 Patch #839877: Remove unused lambda expression. 2003-11-13 07:45:39 +00:00
Martin v. Löwis f56d015a71 Patch #804543: strdup saved locales. Backported to 2.3. 2003-11-13 07:43:21 +00:00
Tim Peters add09b4149 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.
2003-11-12 20:43:28 +00:00
Tim Peters 045f1de57e 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).
2003-11-12 19:30:36 +00:00
Raymond Hettinger 7d1dd04334 Fix typo 2003-11-12 16:42:10 +00:00
Raymond Hettinger bc3cba2881 Explain the advantages of reversed. 2003-11-12 16:39:30 +00:00
Raymond Hettinger 607c00f792 Present each feature in terms of what makes it useful or desirable. 2003-11-12 16:27:50 +00:00
Raymond Hettinger 859db26729 Improve backwards compatibility code to handle True/False. 2003-11-12 15:21:20 +00:00
Raymond Hettinger ad983e79d6 Improve the implementation of itertools.tee().
Formerly, underlying queue was implemented in terms of two lists.  The
new queue is a series of singly-linked fixed length lists.

The new implementation runs much faster, supports multi-way tees, and
allows tees of tees without additional memory costs.

The root ideas for this structure were contributed by Andrew Koenig
and Guido van Rossum.
2003-11-12 14:32:26 +00:00
Neil Schemenauer 767126d7b9 Make Message.__str__ more efficient. 2003-11-11 19:39:17 +00:00
Fred Drake d85ed1b7fc fix typo in markup 2003-11-10 14:50:54 +00:00
Fred Drake 28eae084bf fix use of undefined markup 2003-11-10 14:48:48 +00:00
Fred Drake dbe7980d6a add missing "if" 2003-11-10 14:43:16 +00:00
Martin v. Löwis 75aa4db04b Mention that getsid is new in 2.4. 2003-11-10 06:46:15 +00:00
Martin v. Löwis d8921379e9 Patch #798297: Add IMAP THREAD command. 2003-11-10 06:44:44 +00:00
Martin v. Löwis 49ee14dac5 Patch #839038: Add getsid(2). 2003-11-10 06:35:36 +00:00
Guido van Rossum 967b063add Plug tempfile.mktemp() hole (Iustin Pop). 2003-11-10 02:27:19 +00:00
Guido van Rossum b256159396 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.
2003-11-10 02:16:36 +00:00
Alex Martelli f09994e527 fixed wrong error checking on fcntl call as per SF bug # 821896
(same as commit of Sun Nov 2 to the release23-maint branch)
2003-11-09 16:44:09 +00:00
Alex Martelli 0c5b4ad8f2 fixed obvious bug in _send_header as per SF bug #831271
(same as commit of Sun Nov 2 to the release23-maint branch)
2003-11-09 16:41:38 +00:00
Alex Martelli 721b776175 fixed buggy comment as per SF bug #827856
(same as commit of Sun Nov 2 to the release23-maint branch)
2003-11-09 16:38:39 +00:00
Alex Martelli c516b0e47c 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)
2003-11-09 16:33:56 +00:00
Alex Martelli 37dc334276 Add docs for readmodule_ex and its function-descriptors, fixing
sf bug#812818.
(same as commit of Sun Nov 2 to the release23-maint branch)
2003-11-09 16:32:54 +00:00
Alex Martelli 50324a604c Avoid giving advice that's bad for security, as per SF bug #823515
(same as commit of Sun Nov 2 to the release23-maint branch)
2003-11-09 16:31:18 +00:00
Brett Cannon 35d8360bf7 Document Py_RETURN_NONE. 2003-11-09 04:15:30 +00:00
Andrew M. Kuchling f7a6b67e5c Add 'see also' section pointing to the PEP 2003-11-08 16:05:37 +00:00
Andrew M. Kuchling 1a420251cf Add some recent changes 2003-11-08 15:58:49 +00:00
Raymond Hettinger af28e4b66b Update test to handle list.__reversed__(). 2003-11-08 12:39:53 +00:00
Raymond Hettinger 001f228f36 Improve the reverse list iterator to free memory as soon as the iterator
is exhausted.
2003-11-08 11:58:44 +00:00
Raymond Hettinger e21f606657 SF bug #835457: Small typo in logging documentation 2003-11-08 11:40:03 +00:00
Raymond Hettinger c24c9106e8 Minor code fixup. Make sure that len reflects the current list size. 2003-11-08 11:35:22 +00:00
Raymond Hettinger b3af1813eb Convert heapq.py to a C implementation. 2003-11-08 10:24:38 +00:00
Raymond Hettinger 1021c44b41 Optimize reversed(list) using a custom iterator. 2003-11-07 15:38:09 +00:00
Michael W. Hudson ff1f194982 Fix the problem addressed by patch
[ 819012 ] Fix for former/latter confusion in Extending documentation

although not by using supplied patch.
2003-11-07 11:45:34 +00:00
Raymond Hettinger dc62aeca4c Add a new looping idiom 2003-11-07 01:30:58 +00:00
Martin v. Löwis 5ce2fecf8e Patch #837322: Clarify owning, borrowing, stealing. Backported to 2.3. 2003-11-06 21:08:11 +00:00
Martin v. Löwis d2171d2ba4 Overallocate target buffer for normalization more early. Fixes #834676.
Backported to 2.3.
2003-11-06 20:47:57 +00:00
Raymond Hettinger 85c20a41df Implement and apply PEP 322, reverse iteration 2003-11-06 14:06:48 +00:00
Neil Schemenauer f607fc5395 Add traceback.format_exc(). 2003-11-05 23:03:00 +00:00
Jeremy Hylton 904ed86a77 Make undetected error on stack unwind a fatal error. 2003-11-05 17:29:35 +00:00
Anthony Baxter 92bee36045 missing news entry 2003-11-04 14:35:49 +00:00
Gregory P. Smith 7441e65821 * SF patch 835100 - C++ // comments are not allowed. Use /* */ 2003-11-03 21:35:31 +00:00
Jeremy Hylton ceac90aecb Fix compiler warning about possible use of n without assignment.
Also fix use of n for two different variables in two different blocks.
2003-11-03 20:58:28 +00:00
Gregory P. Smith a703a21b48 * 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.
2003-11-03 01:04:41 +00:00
Raymond Hettinger 83c187460e SF patch #834444: add versionadd to new functions
(Contributed by George Yoshida.)
2003-11-02 09:50:56 +00:00