Neal Norwitz [Tue, 12 Nov 2002 23:01:12 +0000 (23:01 +0000)]
Fix SF # 635969, No error "not all arguments converted"
When mwh added extended slicing, strings and unicode became mappings.
Thus, dict was set which prevented an error when doing:
newstr = 'format without a percent' % string_value
This fix raises an exception again when there are no formats
and % with a string value.
Fred Drake [Tue, 12 Nov 2002 22:19:34 +0000 (22:19 +0000)]
Handle the Content-Type header a little more appropriately: if it
contains options, drop them to get the major/minor content type.
Modified from the supplied patch to support more whitespace variation.
Closes SF patch #613605.
Tim Peters [Tue, 12 Nov 2002 22:08:10 +0000 (22:08 +0000)]
SF patch 637176: list.sort crasher
Armin Rigo's Draconian but effective fix for
SF bug 453523: list.sort crasher
slightly fiddled to catch more cases of list mutation. The dreaded
internal "immutable list type" is gone! OTOH, if you look at a list
*while* it's being sorted now, it will appear to be empty. Better
than a core dump.
Walter Dörwald [Tue, 12 Nov 2002 11:42:20 +0000 (11:42 +0000)]
Use PyInt_AsLong instead of PyInt_AS_LONG after the call to
PyNumber_Int, because now PyNumber_Int might return a long,
and PyInt_AsLong can handle that, whereas PyInt_AS_LONG can't.
Tim Peters [Mon, 11 Nov 2002 19:44:39 +0000 (19:44 +0000)]
Some help for SF 614770: MSVC 7.0 compiler support
This changes sys.version under Microsoft builds to include the MS compiler
version number (_MSC_VER). Since VC 6 and VC 7 are apparently
incompatible, and both can be installed on a single box, distutils needs
some way to figure out which version of MSVC a given Python was compiled
under.
As also suggested by MvL, got rid of #ifdef'ery for the defunct _M_ALPHA
target.
Bugfix candidate? Hard to say. As far as I'm concerned, VC 7 wasn't
a supported platform in the 2.2 line. If somebody thinks it should be,
they can do the work.
Jack Jansen [Mon, 11 Nov 2002 00:05:00 +0000 (00:05 +0000)]
- Building IDE is optional on waste being available, similar to building
IDLE (it was a fatal error before)
- Shuffled a few things around to facilitate the experimental building
of MacPython for Jaguar's pre-installed python.
Tim Peters [Sat, 9 Nov 2002 06:31:56 +0000 (06:31 +0000)]
Many changes to get this to pass on Windows, and to make it easier to
figure out what the code was doing. The fixes were a combination of
closing open files before deletion, opening files in binary mode, and
plain skipping things that can't work on Windows (BaseTest.decompress
uses a process gimmick that doesn't exist on Windows, and, even if it
did, assumes a "bunzip2" executable is on PATH).
Tim Peters [Sat, 9 Nov 2002 04:48:58 +0000 (04:48 +0000)]
Start building the bz2 module on Windows.
CAUTION: The Python test still has many failures, but I'm out of time
for this now (already took much longer than hoped to get this far).
The base bz2 library does pass its own tests (see next).
CAUTION: People building on Windows have to download and build tne
bz2 compression libraries now. See PCbuild\readme.txt for complete
instructions.
Tim Peters [Sat, 9 Nov 2002 04:26:02 +0000 (04:26 +0000)]
BZ2Comp_compress(): changed decl of totalout to LONG_LONG, since it's
solely used to hold LONG_LONG values, and the compiler rightfully warns
about potential data loss otherwise.
[Bug #233259] Ugly traceback for DistutilsPlatformError
Fixed by catching all exceptions that are subclasses of DistutilsError,
so only the error message will be printed. You can still get the
whole traceback by enabling the Distutils debugging mode.
Tim Peters [Fri, 8 Nov 2002 05:26:52 +0000 (05:26 +0000)]
_update(): Commented the new obscurity. Materialized into a tuple
instead of into a list for a bit of speed/space savings. Reopened the
bug report too (628246), as I'm unclear on why we don't sort out the
cause of the TypeError instead.
The _update method detected mutable elements by trapping TypeErrors.
Unfortunately, this masked useful TypeErrors raised by the iterable
itself. For cases where it is possible for an iterable to raise
a TypeError, the iterable is pre-converted to a list outside the
try/except so that any TypeErrors propagate through.
Jack Jansen [Thu, 7 Nov 2002 23:07:05 +0000 (23:07 +0000)]
Got rid of the python.rsrc resource file. The error message strings and
dialogs are now stored in Mac/Lib, and loaded on demand through macresource.
Not only does this simplify a MacPython based on Apple's Python, but
it also makes Mac error codes come out symbolically when running command
line python (if you have Mac/Lib in your path).
The resource files are copied from Mac/Resources. The old ones will disappear
after the OS9 build procedure has been adjusted.
Thomas Heller [Thu, 7 Nov 2002 16:46:19 +0000 (16:46 +0000)]
Use dynamic linking for the SHGetSpecialFolderPath function, it is not
always available on Windows NT. When the function cannot be loaded,
get_special_folder_path raises OSError, "function not available".
This bug happened because: 1) the scanner_search and scanner_match methods
were not checking the buffer limits before increasing the current pointer;
and 2) SRE_SEARCH was using "if (ptr == end)" as a loop break, instead of
"if (ptr >= end)".
* Modules/_sre.c
(SRE_SEARCH): Check for "ptr >= end" to break loops, so that we don't
hang forever if a pointer passing the buffer limit is used.
(scanner_search,scanner_match): Don't increment the current pointer
if we're going to pass the buffer limit.
Fixed bug "[#466200] ability to specify a 'verify' script".
* Lib/distutils/command/bdist_rpm.py
(bdist_rpm.initialize_options): Included verify_script attribute.
(bdist_rpm.finalize_package_data): Ensure that verify_script is a filename.
(bdist_rpm._make_spec_file): Included verify_script in script_options
tuple.
[Patch #633635 from David M. Cooke]
Make keyname raise ValueError if passed -1, avoiding a segfault
Make getkey() match the docs and raise an exception in nodelay mode
The return type of getch() is int, not chtype
Fixed bug #470582, using a modified version of patch #527371,
from Greg Chapman.
* Modules/_sre.c
(lastmark_restore): New function, implementing algorithm to restore
a state to a given lastmark. In addition to the similar algorithm used
in a few places of SRE_MATCH, restore lastindex when restoring lastmark.
(SRE_MATCH): Replace lastmark inline restoring by lastmark_restore(),
function. Also include it where missing. In SRE_OP_MARK, set lastindex
only if i > lastmark.
* Lib/test/re_tests.py
* Lib/test/test_sre.py
Included regression tests for the fixed bugs.
Barry Warsaw [Tue, 5 Nov 2002 21:44:06 +0000 (21:44 +0000)]
parse(), _parseheaders(), _parsebody(): A fix for SF bug #633527,
where in lax parsing, the first non-header line after a header block
(e.g. the first line not containing a colon, and not a continuation),
can be treated as the first body line, even without the RFC mandated
blank line separator.
rfc822 had this behavior, and I vaguely remember problems with this,
but can't remember details. In any event, all the tests still pass,
so I guess we'll find out. ;/
This patch works by returning the non-header, non-continuation line
from _parseheader() and using that as the first header line prepended
to fp.read() if given. It's usually None.
We use this approach instead of trying to seek/tell the file-like
object.