Commit Graph

954 Commits

Author SHA1 Message Date
Raymond Hettinger 166958b5df As discussed on python-dev, added two extractor functions to the
operator module.
2003-12-01 13:18:39 +00:00
Guido van Rossum fd25acacaf Add news item for _winreg fix (SF bug 851056). 2003-11-30 22:10:15 +00:00
Guido van Rossum 6c9e130524 - Removed FutureWarnings related to hex/oct literals and conversions
and left shifts.  (Thanks to Kalle Svensson for SF patch 849227.)
  This addresses most of the remaining semantic changes promised by
  PEP 237, except for repr() of a long, which still shows the trailing
  'L'.  The PEP appears to promise warnings for operations that
  changed semantics compared to Python 2.3, but this is not
  implemented; we've suffered through enough warnings related to
  hex/oct literals and I think it's best to be silent now.
2003-11-29 23:52:13 +00:00
Thomas Heller b310591169 See SF #848614: distutils' msvccompiler now tries to detect that MSVC6
is installed but the registry settings are incomplete because the gui
has never been run.

Already backported to release23-maint.
2003-11-28 19:42:56 +00:00
Martin v. Löwis 94681fc4a3 Patch #849595: Add socket.shutdown() constants. 2003-11-27 19:40:22 +00:00
Raymond Hettinger 4f8f976576 Add optional fillchar argument to ljust(), rjust(), and center() string methods. 2003-11-26 08:21:35 +00:00
Raymond Hettinger bc0f2ab9bb Expose dict_contains() and PyDict_Contains() with is about 10% faster
than PySequence_Contains() and more clearly applicable to dicts.

Apply the new function in setobject.c where __contains__ checking is
ubiquitous.
2003-11-25 21:12:14 +00:00
Guido van Rossum baf0f8f24d - When method objects have an attribute that can be satisfied either
by the function object or by the method object, the function
  object's attribute usually wins.  Christian Tismer pointed out that
  that this is really a mistake, because this only happens for special
  methods (like __reduce__) where the method object's version is
  really more appropriate than the function's attribute.  So from now
  on, all method attributes will have precedence over function
  attributes with the same name.
2003-11-22 23:55:50 +00:00
Tim Peters 403a203223 SF bug 839548: Bug in type's GC handling causes segfaults.
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.
2003-11-20 21:21:46 +00:00
Martin v. Löwis af7dc8d8b8 Patch #831747: Add skip_accept_encoding parameter to putrequest. 2003-11-19 19:51:55 +00:00
Raymond Hettinger 70b9f499a3 Remove deprecation of sets.Set.update(). 2003-11-19 15:52:14 +00:00
Martin v. Löwis 6caea370ac Patch #794400: Let PYTHONSTARTUP influence the compiler flags. 2003-11-18 19:46:25 +00:00
Raymond Hettinger a690a9967e * 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.
2003-11-16 16:17:49 +00:00
Thomas Heller cf0005baf4 Mention patch #841977: modulefinder didn't find extension modules in packages
Backported to release-maint23
2003-11-14 10:33:20 +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
Martin v. Löwis d8921379e9 Patch #798297: Add IMAP THREAD command. 2003-11-10 06:44:44 +00:00
Guido van Rossum 967b063add Plug tempfile.mktemp() hole (Iustin Pop). 2003-11-10 02:27:19 +00:00
Raymond Hettinger b3af1813eb Convert heapq.py to a C implementation. 2003-11-08 10:24:38 +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
Anthony Baxter 92bee36045 missing news entry 2003-11-04 14:35:49 +00:00
Martin v. Löwis 45394c281d Patch #531629: Add multicall support. 2003-10-31 13:49:36 +00:00
Martin v. Löwis 48440b7c27 Patch #: Add POP3 over SSL support. 2003-10-31 12:52:35 +00:00
Raymond Hettinger 0a9b9da0c3 Add list.sorted() classmethod. 2003-10-29 06:54:43 +00:00
Skip Montanaro 030f68a66a note db2pickle/pickle2db tweaks 2003-10-28 16:24:00 +00:00
Armin Rigo 2b3eb4062c Deleting cyclic object comparison.
SF patch 825639
http://mail.python.org/pipermail/python-dev/2003-October/039445.html
2003-10-28 12:05:48 +00:00
Alex Martelli a253e183b8 regressing the performance bugfix -- Guido wants the performance bug left
alone, because there can be no guarantee re the semantics of += vs + .
2003-10-25 23:24:14 +00:00
Alex Martelli dd6664514f document the performance fix to builtin_sum(). 2003-10-25 13:02:57 +00:00
Raymond Hettinger 6a5b027742 Added itertools.tee()
It works like the pure python verion except:
* it stops storing data after of the iterators gets deallocated
* the data queue is implemented with two stacks instead of one dictionary.
2003-10-24 08:45:23 +00:00
Guido van Rossum 16b9fa8db3 - The pwd module incorrectly advertised its struct type as
struct_pwent; this has been renamed to struct_passwd.  (The old name
  is still supported for backwards compatibility.)
2003-10-23 23:54:57 +00:00
Fred Drake de05032cc9 Note the update to Expat 1.95.7. 2003-10-21 15:41:59 +00:00
Brett Cannon 26b3a7b82c Modified the Py_RETURN_* macros by having the statements surrounded by {} in
order to prevent any unexpected surprises from someone using them in a
conditional without using curly braces (e.g., ``if (foo) Py_RETURN_TRUE``.
2003-10-19 21:31:43 +00:00
Martin v. Löwis 01a74b2fa1 Make CObjects mutable. Fixes #477441. 2003-10-19 18:30:01 +00:00
Gustavo Niemeyer ad3fc44ccb Implemented non-recursive SRE matching. 2003-10-17 22:13:16 +00:00
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
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
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
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
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 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
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
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 ca9e21c9c6 Partial progress on NEWS. 2003-07-17 17:57:58 +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
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
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