SF bug #801342: Bug (documentation or real, your choice) in random.sample.
random.sample() uses one of two algorithms depending on the ratio of the
sample size to the population size. One of the algorithms accepted any
iterable population argument so long as it defined __len__(). The other
had a stronger requirement that the population argument be indexable.
While it met the documentation specifications which insisted that the
population argument be a sequence, it made random.sample() less usable
with sets. So, the second algorithm was modified to coerce non-indexable
iterables and dictionaries into a tuple before proceeding.
Barry Warsaw [Wed, 3 Sep 2003 04:21:29 +0000 (04:21 +0000)]
A fix for parsing parameters when there are semicolons inside the
quotes. Fixes SF bug #794466, with the essential patch provided by
Stuart D. Gathman. Specifically,
_parseparam(), _get_params_preserve(): Use the parsing function that
takes quotes into account, as given (essentially) in the bug report's
test program.
Barry Warsaw [Wed, 3 Sep 2003 03:23:44 +0000 (03:23 +0000)]
Fix for SF bug #780996, crash when no .pynche file exists and -d
option is not given. If dbfile isn't given and can't be retrieved
from the optionsdb, just initialize it to the first element in
RGB_TXT.
For smaller datasets, it is not always true the increasing the compression
level always results in better compression. Removed the test which made
this invalid assumption.
When the indents were set to longer than the width and long word breaking
was enabled, an infinite loop would result because the inner loop did not
assure that at least one character was stripped off on every pass.
Jack Jansen [Fri, 29 Aug 2003 22:46:25 +0000 (22:46 +0000)]
A makefile and setup script to create the bits that are part of
MacPython but not of Apple's Panther distribution: the waste module,
the IDE and BuildApplet applets.
Jason Tishler [Tue, 26 Aug 2003 11:59:41 +0000 (11:59 +0000)]
test_largefile can leave its temp file open if one of many tests fail. On
platforms (e.g., Cygwin) that are "particular" about open files, this will
cause other regression tests that use the same temp file to fail:
This patch solves the problem by adding missing "try/finally" blocks. Note
that the "large" size of this patch is due to many white space changes --
otherwise, the patch is small.
Backport improvements to set.py so that the interface will remain
consistent across versions.
* 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.
* Added a PendingDeprecationWarning for 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.
Walter Dörwald [Thu, 14 Aug 2003 21:00:28 +0000 (21:00 +0000)]
Backport checkin:
Fix refcount leak in the UnicodeError constructor:
When parsing the constructor arguments failed, a
reference to the argument tuple was leaked.
Walter Dörwald [Thu, 14 Aug 2003 20:26:44 +0000 (20:26 +0000)]
Backport checkins:
Fix refcount leak in PyUnicode_EncodeCharmap(). The bug surfaces
when an encoding error occurs and the callback name is unknown,
i.e. when the callback has to be called. The problem was that
the fact that the callback has already been looked up was only
recorded in a local variable in charmap_encoding_error(), because
charmap_encoding_error() got it's own copy of the errorHandler
pointer instead of a pointer to the pointer in
PyUnicode_EncodeCharmap().
Walter Dörwald [Tue, 12 Aug 2003 17:38:22 +0000 (17:38 +0000)]
Backport checkins:
* Enhance message for UnicodeEncodeError and UnicodeTranslateError.
If there is only one bad character it will now be printed in a
form that is a valid Python string.
* Add a unicode prefix to the characters in the UnicodeEncodeError
and UnicodeTranslateError message.
The default seed is time.time().
Multiplied by 256 before truncating so that fractional seconds are used.
This way, two consequetive calls to random.seed() are much more likely
to produce different sequences.
Brett Cannon [Wed, 6 Aug 2003 21:17:09 +0000 (21:17 +0000)]
Re-introduction of caching. Not thread-safe against the changing of locale
in the middle of executing time.strptime . Added new tests for caching
mechanism; taken from 2.4 branch and tweaked appropriately.