Commit Graph

1664 Commits

Author SHA1 Message Date
Raymond Hettinger 42b1ba31af * list.sort() now supports three keyword arguments: cmp, key, and reverse.
key provides C support for the decorate-sort-undecorate pattern.
  reverse provide a stable sort of the list with the comparisions reversed.

* Amended the docs to guarantee sort stability.
2003-10-16 03:41:09 +00:00
Brett Cannon 90f7d254a9 Added Bjorn Pettersen for initial conversion of Lib/platform.py's docstring to LaTeX. 2003-10-14 21:47:28 +00:00
Raymond Hettinger cb2da43db8 Extended tuple's C API to include a new function, PyTuple_Pack() that is
useful for rapidly building argument tuples without having to invoke the
more sophisticated machinery of Py_BuildValue().
2003-10-12 18:24:34 +00:00
Martin v. Löwis d662548c72 Patch #810914: Return absolute path for mkstemp. Fixes #810408.
This should not be backported to 2.3, as it might break backwards
compatibility.
2003-10-12 17:37:01 +00:00
Brett Cannon 5d9ca4ebfd Add mention of urlparse becoming RFC 2396 compliant. 2003-10-12 04:38:48 +00:00
Brett Cannon eab353ddc7 See rev. 1.250 for log message 2003-10-12 04:29:10 +00:00
Guido van Rossum 02c58f865c SF patch #820195 by Wojtek Walczak (gminick at users.sourceforge.net):
make obj.__contains__() returns True/False instead of 1/0.
2003-10-08 21:08:29 +00:00
Raymond Hettinger 2f726e9093 SF bug #812202: randint is always even
* Added C coded getrandbits(k) method that runs in linear time.
* Call the new method from randrange() for ranges >= 2**53.
* Adds a warning for generators not defining getrandbits() whenever they
  have a call to randrange() with too large of a population.
2003-10-05 09:09:15 +00:00
Anthony Baxter 5c68ef04b7 two bugfixes 2003-10-04 08:04:04 +00:00
Jeremy Hylton f64ec0f2a1 A helper to dump info about the current frame,
assuming it is the variable f.
2003-10-03 20:56:15 +00:00
Skip Montanaro def9934c91 forgot the NEWS blurb about the change to csv.DictReader 2003-10-03 14:07:07 +00:00
Martin v. Löwis 3bbd6543a0 Patch #813445: Add IPPROTO_IPV6 option to the socketmodule. 2003-10-03 13:57:37 +00:00
Anthony Baxter fd95c3a466 updates from sean 2003-09-24 01:36:13 +00:00
Raymond Hettinger 9a80c5dbc4 Added codec for bz2 compression. 2003-09-23 20:21:01 +00:00
Guido van Rossum 0e5a51d962 New for unittest.py. 2003-09-22 15:03:11 +00:00
Marc-André Lemburg d7160f8845 Added test whether wchar_t is signed or not. A signed wchar_t is not usable as internal unicode type base for Py_UNICODE since the unicode implementation assumes an unsigned type. 2003-09-22 11:14:40 +00:00
Martin v. Löwis e7a9796a0f Patch #800697: Add readline.clear_history. 2003-09-20 16:08:33 +00:00
Martin v. Löwis c6bb6c0f8c Patch #707167: Pass dircache exceptions to the caller. Fixes #682813.
Not backported because of behaviour change.
2003-09-20 15:52:21 +00:00
Jeremy Hylton d808279be3 Double-fix of crash in Unicode freelist handling.
If a length-1 Unicode string was in the freelist and it was
uninitialized or pointed to a very large (magnitude) negative number,
the check

	 unicode_latin1[unicode->str[0]] == unicode

could cause a segmentation violation, e.g. unicode->str[0] is 0xcbcbcbcb.

Fix this in two ways:

1. Change guard befor unicode_latin1[] to test against 256U.  If I
   understand correctly, the unsigned long used to store UCS4 on my
   box was getting converted to a signed long to compare with the
   signed constant 256.

2. Change _PyUnicode_New() to make sure the first element of str is
   always initialized to zero.  There are several places in the code
   where the caller can exit with an error before initializing any
   of str, which would leave junk in str[0].

Also, silence a compiler warning on pointer vs. int arithmetic.

Bug fix candidate.
2003-09-16 19:41:39 +00:00
Raymond Hettinger deadbf50e4 SF #662923
Add support for the iterator and mapping protocols.
For Py2.3, this was done for shelve, dumbdbm and other mapping objects, but
not for bsddb and dbhash which were inadvertently missed.
2003-09-12 06:33:37 +00:00
Brett Cannon 62dba4c277 select.select() now accepts a sequence (as defined by PySequence_Fast()) for
its first three arguments.

Closes RFE #798046 .
2003-09-10 19:37:42 +00:00
Skip Montanaro fd4fa8801a mention new module doc display feature of pydoc in libref and NEWS 2003-09-10 19:04:13 +00:00
Tim Peters f1827cfaab SF bug 801631: file.truncate fault on windows.
file_truncate():  C doesn't define what fflush(fp) does if fp is open
for update, and the preceding I/O operation on fp was input.  On Windows,
fflush() actually changes the current file position then.  Because
Windows doesn't support ftruncate() directly, this not only caused
Python's file.truncate() to change the file position (contra our docs),
it also caused the file not to change size.

Repaired by getting the initial file position at the start, restoring
it at the end, and tossing all the complicated micro-efficiency checks
trying to avoid "provably unnecessary" seeks.  file.truncate() can't
be a frequent operation, and seeking to the current file position has
got to be cheap anyway.

Bugfix candidate.
2003-09-07 03:30:18 +00:00
Skip Montanaro 3f7a94824e **kwds arg was missing from __init__ for Dict{Reader,Writer} classes.
will backport.
2003-09-06 19:52:12 +00:00
Barry Warsaw 2f5bf17579 NEWS about email package 794466 patch. 2003-09-03 04:09:49 +00:00
Barry Warsaw 6ec58ca9cf Document the Pynche patch. 2003-09-03 03:20:37 +00:00
Raymond Hettinger 3b9cff1ef5 SF 798269: bug fix for doctest (sf bug id: 798254
(Contributed by Alexander Belopolsky.)
2003-09-02 02:17:46 +00:00
Raymond Hettinger ec99b5fbfa SF patch #798534: Windows os.popen needlessly gets a reference to tuple ()
(Contributed by Andrew Gaul.)

Fixes a minor leak.
2003-09-01 22:34:31 +00:00
Raymond Hettinger 14cc1e3222 SF patch #798467: Update docstring of has_key for bool changes
(Contributed by George Yoshida.)
2003-09-01 22:17:18 +00:00
Raymond Hettinger 9bfe533c69 SF bug #795506: Wrong handling of string format code for float values.
Adding missing support for '%F'.

Will backport to 2.3.1.
2003-08-27 04:55:52 +00:00
Raymond Hettinger e41d4c8ec9 Added doubled word warnings. 2003-08-25 04:39:55 +00:00
Barry Warsaw d24a2a464f Describe the fix to the email package. 2003-08-19 03:59:09 +00:00
Tim Peters 1a3abcb648 This started opening files in text mode by default in the 2.3 release,
which is a disaster on Windows.  Restored the binary default of all
previous releases.  Also minor code cleanups.

Bugfix candidate!
2003-08-18 23:52:09 +00:00
Raymond Hettinger 6a1801271a Improvements to set.py:
* Relaxed the argument restrictions for non-operator methods.  They now
  allow any iterable instead of requiring a set.  This makes the module
  a little easier to use and paves the way for an efficient C
  implementation which can take better advantage of iterable arguments
  while screening out immutables.

* Deprecated Set.update() because it now duplicates Set.union_update()

* Adapted the tests and docs to include the above changes.

* Added more test coverage including testing identities and checking
  to make sure non-restartable generators work as arguments.

Will backport to Py2.3.1 so that the interface remains consistent
across versions.  The deprecation of update() will be changed to
a FutureWarning.
2003-08-17 08:34:09 +00:00
Raymond Hettinger ee562fc084 Make sets.py compatible with Py2.2 2003-08-15 21:17:04 +00:00
Tim Peters 465fa3dac4 complex_new(): This could leak when the argument was neither string nor
number.  This accounts for the 2 refcount leaks per test_complex run
Michael Hudson discovered (I figured only I would have the stomach to
look for leaks in floating-point code <wink>).
2003-08-15 01:16:37 +00:00
Andrew M. Kuchling 69f31eb80c [Patch #739124] Add use_default_colors() to curses module 2003-08-13 23:11:04 +00:00
Michael W. Hudson cc9d004f81 mention pymemcompat.h in Misc/README 2003-08-11 16:18:43 +00:00
Raymond Hettinger 3081d59f92 SF bug #778964: bad seed in python 2.3 random
The default seed is time.time().
Multiplied by 256 before truncating so that fractional seconds are used.
This way, two successive calls to random.seed() are much more likely
to produce different sequences.
2003-08-09 18:30:57 +00:00
Raymond Hettinger 5475f2394a SF bug #770485: cStringIO does not set closed attr 2003-08-08 12:20:03 +00:00
Raymond Hettinger b5a420883c Modified itertools.izip() to match the behavior of __builtin__.zip()
which can now take zero arguments.
2003-08-08 05:10:41 +00:00
Raymond Hettinger beb35f4da3 Removed deprecated functions 2003-08-05 12:32:41 +00:00
Anthony Baxter 83f5291c0f forgot to commit this - note about the signal module SIGRT(MIN,MAX) 2003-08-05 06:33:56 +00:00
Brett Cannon b7150a23f7 Mention caching and better thread-safety for Lib/_strptime.py 2003-08-05 06:27:04 +00:00
Raymond Hettinger eaef615116 As discussed on python-dev, changed builtin.zip() to handle zero arguments
by returning an empty list instead of raising a TypeError.
2003-08-02 07:42:57 +00:00
Skip Montanaro cb3988c48b add skeletal "what's new" for 2.4a1 and mention a couple python-mode tweaks. 2003-08-01 05:01:54 +00:00
Skip Montanaro 031611635d delete the f1 key binding. py-help-at-point is still available @ C-c C-h. 2003-08-01 04:27:34 +00:00
Skip Montanaro 98a4fbe043 make pending-delete/delete-selection mode work with py-electric-colon 2003-08-01 04:00:32 +00:00
Skip Montanaro 4563769be9 tweak to py-fill-paragraph - problem noted by John Lee and correction
submitted by Bernard Herzog.  Closes patch 779830.
2003-07-31 04:59:48 +00:00
Walter Dörwald 73a8a4b9df Fix typo. 2003-07-30 12:14:02 +00:00
Barry Warsaw 5a2e2c1d98 Get rid of empty sections 2003-07-29 22:11:31 +00:00
Tim Peters 36c1afc47a SF bug 778400: IDLE hangs when selecting "Edit with IDLE".
The fix is confined to the Windows installer.

Not a bugfix candidate:  the need for the new -n switch added here was
introduced by moving to the idlefork IDLE (so this change isn't needed
or helpful before 2.3).
2003-07-29 17:22:57 +00:00
Tim Peters 0963803dcb Added section for 2.3 final; moved IDLE news into it that I inserted in
a wrong place over the weekend.
2003-07-29 00:10:29 +00:00
Tim Peters c794a1cb2f Gave the main NEWS file its own IDLE section, and populated it with a
blurb about ZoneAlarm (etc) nags.
2003-07-27 20:23:49 +00:00
Barry Warsaw 0517c9aea6 Updated news for 2.3c2. 2003-07-25 01:09:40 +00:00
Tim Peters 6560a254ea Update version numbers and dates for 2.3c2 -- we won't be able to do this
during the day tomorrow, so doing it earlier than I'd like.
2003-07-24 00:15:46 +00:00
Jack Jansen e004041e96 Bugfix for #775892: added -mno-fused-madd to BASECFLAGS on MacOSX.
This makes test_coercion pass on Panther.

Also added a note to NEWS that pythonw works again (it was broken in rc1).
2003-07-23 22:17:28 +00:00
Thomas Heller 354e3d90d3 Change the zipimport implementation to accept files containing
arbitrary bytes before the actual zip compatible archive.  Zipfiles
containing comments at the end of the file are still not supported.

Add a testcase to test_zipimport, and update NEWS.

This closes sf #775637 and sf #669036.
2003-07-22 18:10:15 +00:00
Tim Peters 291f14e3d3 Windows fix: When PYTHONCASEOK is set, or for any other reason imports
are satisfied in a case-insensitive manner, the attempt to import (the
non-existent) fcntl gets satisfied by FCNTL.py instead, and the tempfile
module defines a Unix-specific _set_cloexec() function in that case.  As
a result, temp files can't be created then (blows up with an AttributeError
trying to reference fcntl.fcntl).  This just popped up in the spambayes
project, where there is no apparent workaround (which is why I'm pushing
this in now).
2003-07-22 02:50:01 +00:00
Fred Drake 01a4312a77 Added note about the pyexpat memory leak fix. 2003-07-21 17:17:10 +00:00
Tim Peters 6a627250d2 Merge 23c1-branch back into the head. Barry will send email about the
New Plan (releases to be made off the head, ongoing random 2.4 stuff
to be done on a short-lived branch, provided anyone is motivated enough
to create one).
2003-07-21 14:25:23 +00:00
Barry Warsaw d71a5511a4 Minor typo 2003-07-20 18:00:54 +00:00
Jeremy Hylton b434d49876 Oh, well. 2003-07-18 20:57:04 +00:00
Jeremy Hylton 0ed18c2917 Forgot the release date. 2003-07-18 20:10:02 +00:00
Jeremy Hylton 8aca417483 The rest of the news. 2003-07-17 19:19:05 +00:00
Jeremy Hylton ed860039f5 SF patch 764470 2003-07-17 19:18:50 +00:00
Jeremy Hylton ca9e21c9c6 Partial progress on NEWS. 2003-07-17 17:57:58 +00:00
Jeremy Hylton dabc37ce7b SF bug 770601. 2003-07-17 17:23:30 +00:00
Neil Schemenauer af4c5059d5 Remove code that tried to warn about shadowing builtin names after a
module had been compiled.  It gives too many spurious warnings.
2003-07-16 22:19:24 +00:00
Andrew M. Kuchling 6c733d3711 Add mmap bugfix; typo and grammar fixes 2003-07-16 20:11:34 +00:00
Raymond Hettinger 71adf7e9d8 Doctest now examines all docstrings by default. Previously, it would
skip over functions with private names (as indicated by the underscore
naming convention).  The old default created too much of a risk that
user tests were being skipped inadvertently.  Note, this change could
break code in the unlikely case that someone had intentionally put
failing tests in the docstrings of private functions.  The breakage
is easily fixable by specifying the old behavior when calling testmod()
or Tester().  The more likely case is that the silent failure was
unintended and that the user needed to be informed so the test could be
fixed.
2003-07-16 19:25:22 +00:00
Tim Peters 7a6c733c3b Make close() identical to __del__() for a dumbdbm database. Make
closing idempotent (it used to raise a nuisance exception on the 2nd
close attempt).

Bugfix candidate?  Probably, but arguable.
2003-07-13 17:21:10 +00:00
Tim Peters 0320464583 Repaired typos in comments. 2003-07-13 02:37:05 +00:00
Tim Peters d7472ec13a Fixed critical shutdown race in _Database._commit.
Related to SF patch 723231 (which pointed out the problem, but didn't
fix it, just shut up the warning msg -- which was pointing out a dead-
serious bug!).

Bugfix candidate.
2003-07-13 02:22:03 +00:00
Raymond Hettinger ca60cac3a4 Update for new module and new builtin. 2003-07-12 23:55:57 +00:00
Tim Peters e5e065b669 New function sys.getcheckinterval(), to complement setcheckinterval(). 2003-07-06 18:36:54 +00:00
Tim Peters 2e7e7df969 An Anonymous Coward on c.l.py posted a little program with bizarre
behavior, creating many threads very quickly.  A long debugging session
revealed that the Windows implementation of PyThread_start_new_thread()
was choked with "laziness" errors:

1. It checked MS _beginthread() for a failure return, but when that
   happened it returned heap trash as the function result, instead of
   an id of -1 (the proper error-return value).

2. It didn't consider that the Win32 CreateSemaphore() can fail.

3. When creating a great many threads very quickly, it's quite possible
   that any particular bootstrap call can take virtually any amount of
   time to return.  But the code waited for a maximum of 5 seconds, and
   didn't check to see whether the semaphore it was waiting for got
   signaled.  If it in fact timed out, the function could again return
   heap trash as the function result.  This is actually what confused
   the test program, as the heap trash usually turned out to be 0, and
   then multiple threads all got id 0 simultaneously, confusing the
   hell out of threading.py's _active dict (mapping id to thread
   object).  A variety of baffling behaviors followed from that.

WRT #1 and #2, error returns are checked now, and "thread.error: can't
start new thread" gets raised now if a new thread (or new semaphore)
can't be created.  WRT #3, we now wait for the semaphore without a
timeout.

Also removed useless local vrbls, folded long lines, and changed callobj
to a stack auto (it was going thru malloc/free instead, for no discernible
reason).

Bugfix candidate.
2003-07-04 04:40:45 +00:00
Skip Montanaro eec26f982a Correct documentation of check interval - it's 100 by default, not 10 any
longer.  Pointed out by Alex Martelli.
2003-07-02 21:38:34 +00:00
Neal Norwitz 3c0f2c91ad Fix SF bug #763637, 2.3b2 unpack tuple of wrong size in after_cancel
Tk 8.4 may return different values than 8.3.  This fix should handle
either version.
2003-07-01 21:12:47 +00:00
Tim Peters 59aba128a5 Make the classes exposed by threading.py new-style classes. This is
mostly for convenience and to aid debugging.
2003-07-01 20:01:55 +00:00
Neal Norwitz e7dfe21bed Fix SF bug #763023, difflib.py: ratio() zero division not caught
Backport candidate
2003-07-01 14:59:46 +00:00
Brett Cannon 20def8bb19 Make temporary change of using _strptime for time.strptime permanent.
Flesh out docs to better explain time.strptime (closes bug #697990).
2003-07-01 05:16:08 +00:00
Neal Norwitz 592c4cc460 SF bug 753592, websucker bug
Pass the proper variable when the user supplies a directory.
Will backport.
2003-07-01 04:14:28 +00:00
Raymond Hettinger d693a81595 Fix SF 762891: "del p[key]" on proxy object raises SystemError() 2003-06-30 04:18:48 +00:00
Raymond Hettinger 562a855da0 Merge branch updates back into the main trunk 2003-06-30 03:35:06 +00:00
Jeremy Hylton b752c27801 Add several news items for changes I made since b1. 2003-06-29 17:25:39 +00:00
Tim Peters 5e2ed818b7 Removed XXX comments about missing threading.py functions. 2003-06-29 17:12:30 +00:00
Barry Warsaw 883f22321a Added news about os.environ['PYTHONINSPECT'] = 'yes' 2003-06-29 17:10:11 +00:00
Tim Peters c98ccfd29f Typo repair. 2003-06-29 16:56:38 +00:00
Tim Peters 685e69739e Provide dummy (do-nothing) settrace() and setprofile() functions until
Jeremy can check in the real things.
2003-06-29 16:50:06 +00:00
Tim Peters 2740944361 Filled in release date; repaired grammar in a news item. 2003-06-29 16:18:08 +00:00
Tim Peters db3756dade Some nifty doctest extensions from Jim Fulton, currently used in Zope3.
I won't have time to write real docs, but spent a lot of time adding
comments to his code and fleshing out the exported functions' docstrings.
There's probably opportunity to consolidate how docstrings get extracted
too, and the new code for that is probably better than the old code for
that (which strained mightily to recover from 2.2's new class/type
gimmicks).
2003-06-29 05:30:48 +00:00
Raymond Hettinger 643bcecad0 SF patch #760257: add socket.timeout exception 2003-06-29 03:29:42 +00:00
Raymond Hettinger a4148c3cc8 Added Bob Halley for work on socket.timeout 2003-06-29 03:27:45 +00:00
Raymond Hettinger 90a2041ffd Added Steven Taschuk for efforts fixing zipfile.py 2003-06-28 20:10:26 +00:00
Raymond Hettinger c0fac96c29 SF patch #756996: Bare except in ZipFile.testzip()
(Contributed by Steven Taschuk)

Replaces a bare except that caused all errors to be mis-reported as
archive errors.

Added a related NEWS item.
2003-06-27 22:25:03 +00:00
Raymond Hettinger 6f3eaa67e5 SF patch #761519: Fixes for bugs 760703 and 757821
SF bug #760703: SocketHandler and LogRecord don't work well together
SF bug #757821: logging module docs

Applied Vinay Sajip's patch with a few minor fixups and a NEWS item.

Patched __init__.py - added new function
makeLogRecord (for bug report 760703).

Patched handlers.py - updated some docstrings and
deleted some old commented-out code.

Patched test_logging.py to make use of makeLogRecord.

Patched liblogging.tex to fill documentation gaps (both
760703 and bug 757821).
2003-06-27 21:43:39 +00:00
Tim Peters 6ebe61fa80 A hack to ease compatibility with pre-2.3 Pythons: by default, doctest
now accepts "True" when a test expects "1", and similarly for "False"
versus "0".  This is un-doctest-like, but on balance makes it much
more pleasant to write doctests that pass under 2.2 and 2.3.  I expect
it to go away again, when 2.2 is forgotten.  In the meantime, there's
a new doctest module constant that can be passed to a new optional
argument, if you want to turn this behavior off.

Note that this substitution is very simple-minded:  the expected and
actual outputs have to consist of single tokens.  No attempt is made,
e.g., to accept [True, False] when a test expects [1, 0].  This is a
simple hack for simple tests, and I intend to keep it that way.
2003-06-27 20:48:05 +00:00
Tim Peters faa697a5c9 2.3b2 on Windows will ship with Tcl/Tk 8.4.3. Note: this still didn't
fix the hangs on Win98SE when starting IDLE via "python" from a DOS box,
but did appear to make them harder to provoke.  I closed that bug report
as being hopeless (and if someone wants to open it again, don't dare
assign it to me again <0.1 wink>).
2003-06-22 01:42:20 +00:00
Ken Manheimer 8e9b80fd56 Remove short-circuitying grubbing by using last grubbed buffer. It's
evil - if the last grubbed buffer didn't happen to be the right one,
you couldn't remedy.

Mainline emacs compat - don't use third arg to buffer-substring (which
was for explicitly identifying the buffer in which to seek the
substring, and which turns out to be unnecessary).
2003-06-17 19:18:57 +00:00