Jeremy Hylton [Tue, 16 Sep 2003 19:41:39 +0000 (19:41 +0000)]
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.
Jeremy Hylton [Tue, 16 Sep 2003 03:41:45 +0000 (03:41 +0000)]
Change checks of PyUnicode_Resize() return value for clarity.
The unicode_resize() family only returns -1 or 0 so simply checking
for != 0 is sufficient, but somewhat unclear. Many Python API
functions return < 0 on error, reserving the right to return 0 or 1 on
success. Change the call sites for consistency with these calls.
Steve Purcell [Mon, 15 Sep 2003 11:01:21 +0000 (11:01 +0000)]
Explicitly define public symbols via __all__: see discussion with Raymond
Hettinger in comments for issue 804115
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=804115&group_id=5470
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.
Fred Drake [Thu, 11 Sep 2003 04:08:47 +0000 (04:08 +0000)]
try to fix up the padding inside a notice environment so they fit in a
little better, with similar spacing characteristics with the seealso
environment
Kurt B. Kaiser [Wed, 10 Sep 2003 02:42:18 +0000 (02:42 +0000)]
Python Bug 775061
1. Remove "idle" script, it lives in Tools/scripts/ now.
2. Remove shebang from idle.py, should be called explicitly.
3. Remove obsolete test code from rpc.py; needs unit test.
Tim Peters [Sun, 7 Sep 2003 03:30:18 +0000 (03:30 +0000)]
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.
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.
Fred Drake [Fri, 5 Sep 2003 15:43:00 +0000 (15:43 +0000)]
fix some nuissance formatting problems for the "alltt" environment;
there's still a bug for the environment, but that's worked around in
this change as well
Jason Tishler [Thu, 4 Sep 2003 11:59:50 +0000 (11:59 +0000)]
Bug #794140: cygwin builds do not embed
The embed2.diff patch solves the user's problem by exporting the missing
symbols from the Python core so Python can be embedded in another Cygwin
application (well, at lest vim).
Jason Tishler [Thu, 4 Sep 2003 11:04:06 +0000 (11:04 +0000)]
This patch enables the building of Cygwin Python with a static core
which still supports shared extensions. It takes advantage the latest
Cygwin binutils (i.e., 20030901-1) which can export symbols from
executables:
Barry Warsaw [Wed, 3 Sep 2003 04:08:13 +0000 (04:08 +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:15:50 +0000 (03:15 +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.