Just van Rossum [Thu, 2 Jan 2003 13:13:01 +0000 (13:13 +0000)]
Replaced imp.set_frozenmodules() cruft with proper zipimport support.
This work uncovered the zipimport bug in 2.3a1 -- wish I'd had time to
do this before the release :-(.
Just van Rossum [Thu, 2 Jan 2003 12:55:48 +0000 (12:55 +0000)]
Ugh, zipimport is virtually broken in 2.3a1 :-( It worked by accident in
the test set as it only tested with a zip archive in the current directory,
but it doesn't work at all for packages when the zip archive was specified
as an absolute path. It's a real embarrassing bug: a strchr call should
have been strrchr; fever apparently implies dyslexia.
Second stupid bug: the zipimport test failed with a name error
__importer__ (which I had renamed to __loader__ everywhere but here).
I would've sworn I ran the test after that change but that can't be true.
What I don't understand that noone reported a failing test_zipimport.py
before the release of 2.3a1.
Tim Peters [Thu, 2 Jan 2003 03:14:59 +0000 (03:14 +0000)]
Completed astimezone's correctness proof. That doesn't mean it's
correct by your lights, it means that-- barring coding errors --it
implements what it intended to implement.
Anthony Baxter [Thu, 2 Jan 2003 03:07:48 +0000 (03:07 +0000)]
Clearing out old patch queue. Patch #558547, make SocketServer more
robust. This makes socketserver's close() method callable repeatedly
without error - similar to other file-like objects.
Tim Peters [Wed, 1 Jan 2003 21:51:37 +0000 (21:51 +0000)]
A quicker astimezone() implementation, rehabilitating an earlier
suggestion from Guido, along with a formal correctness proof of the
trickiest bit. The intricacy of the proof reveals how delicate this
is, but also how robust the conclusion: correctness doesn't rely on
dst() returning +- one hour (not all real time zones do!), it only
relies on:
1. That dst() returns a (any) non-zero value if and only if daylight
time is in effect.
and
2. That the tzinfo subclass implements a consistent notion of time zone.
The meaning of "consistent" was a hidden assumption, which is now an
explicit requirement in the docs. Alas, it's an unverifiable (by the
datetime implementation) requirement, but so it goes.
Skip Montanaro [Wed, 1 Jan 2003 20:07:49 +0000 (20:07 +0000)]
Split OPT make variable into OPT and BASECFLAGS. The latter contains those
compiler flags which are necessary to get a clean compile. The former is
for user-specified optimizer, debug, trace fiddling. See patch 640843.
Add /sw/lib and /sw/include to setup.py search paths on Darwin to take
advantage of fink goodies.
Add scriptsinstall target to Makefile to install certain scripts from
Tools/scripts directory.
Tim Peters [Wed, 1 Jan 2003 04:48:01 +0000 (04:48 +0000)]
datetimetz_astimezone(): Speed optimizations -- although I'd rather
find a more elegant algorithm (OTOH, the hairy new implementation allows
user-written tzinfo classes to be elegant, so it's a big win even if
astimezone() remains hairy).
Darn! I've only got 10 minutes left to get falling-down drunk! I suppose
I'll have to smoke crack instead now.
Tim Peters [Wed, 1 Jan 2003 04:18:51 +0000 (04:18 +0000)]
The failure of the last-second addition to the timezone coversion test is
understood now: it can't work. Added comments explaining why (it's "the
usual"-- unrepresentable hours in local time --but in a slightly different
guise).
Kurt B. Kaiser [Wed, 1 Jan 2003 00:26:41 +0000 (00:26 +0000)]
Debugger was tracing through rpc.py when IDLEfork was not started
from its source directory. Generalize the "workaround" (though
the latter seems a reasonable solution?) to handle this.
Jason Tishler [Tue, 31 Dec 2002 20:30:46 +0000 (20:30 +0000)]
Patch #660485: Cygwin _tkinter Tcl/Tk 8.3 patch
The attached patch enables Cygwin Python to
build cleanly against the latest Cygwin Tcl/Tk
which is based on Tcl/Tk 8.3. It also prevents
building against the real X headers, if installed.
Jeremy Hylton [Tue, 31 Dec 2002 18:26:17 +0000 (18:26 +0000)]
Replace all but one explicit emit('SET_LINENO') with call to set_lineno().
Remove broken code in visitDict(). I assume the code was trying to
add set lineno events for each line of a dict constructor, but I think
it was using the wrong object (node instead of k or v).
Jeremy Hylton [Tue, 31 Dec 2002 18:17:44 +0000 (18:17 +0000)]
SF patch [ 597919 ] compiler package and SET_LINENO
A variety of changes from Michael Hudson to get the compiler working
with 2.3. The primary change is the handling of SET_LINENO:
# The set_lineno() function and the explicit emit() calls for
# SET_LINENO below are only used to generate the line number table.
# As of Python 2.3, the interpreter does not have a SET_LINENO
# instruction. pyassem treats SET_LINENO opcodes as a special case.
A few other small changes:
- Remove unused code from pycodegen and pyassem.
- Fix error handling in parsermodule. When PyParser_SimplerParseString()
fails, it sets an exception with detailed info. The parsermodule
was clobbering that exception and replacing it was a generic
"could not parse string" exception. Keep the original exception.
Tim Peters [Tue, 31 Dec 2002 17:36:56 +0000 (17:36 +0000)]
A new, and much hairier, implementation of astimezone(), building on
an idea from Guido. This restores that the datetime implementation
never passes a datetime d to a tzinfo method unless d.tzinfo is the
tzinfo instance whose method is being called. That in turn allows
enormous simplifications in user-written tzinfo classes (see the Python
sandbox US.py and EU.py for fully fleshed-out examples).
d.astimezone(tz) also raises ValueError now if d lands in the one hour
of the year that can't be expressed in tz (this can happen iff tz models
both standard and daylight time). That it used to return a nonsense
result always ate at me, and it turned out that it seemed impossible to
force a consistent nonsense result under the new implementation (which
doesn't know anything about how tzinfo classes implement their methods --
it can only infer properties indirectly). Guido doesn't like this --
expect it to change.
New tests of conversion between adjacent DST-aware timezones don't pass
yet, and are commented out.
Running the datetime tests in a loop under a debug build leaks 9
references per test run, but I don't believe the datetime code is the
cause (it didn't leak the last time I changed the C code, and the leak
is the same if I disable all the tests that invoke the only function
that changed here). I'll pursue that next.
Fred Drake [Tue, 31 Dec 2002 17:23:27 +0000 (17:23 +0000)]
Further cleanup of exceptions. All interpolation-related exceptions
now derive from InterpolationError, which is not raised directly (only
subclasses get raised). This matches what the docs already said.
Skip Montanaro [Tue, 31 Dec 2002 16:56:20 +0000 (16:56 +0000)]
Bernhard Herzog's paragraph and string-filling code. I've been using it for
a month or two with great success. Barry may want to tweak it some, but I
think it's a worthwhile enough addition to get some more people trying it
out.
Guido van Rossum [Tue, 31 Dec 2002 16:33:01 +0000 (16:33 +0000)]
Fix an out-of-bound index in pmerge() discovered by Zooko (SF bug
645404). I'm not 100% sure this is the right fix, so I'll keep the
bug report open for Samuele, but this fixes the index error and passes
the test suite (and I can't see why it *shouldn't* be the right fix
:-).
Just van Rossum [Tue, 31 Dec 2002 16:33:00 +0000 (16:33 +0000)]
patch attached to sf item #643711:
any_missing() returns less bogus missing modules.
- I've rewritten scan_code() more or less from scratch,
factored bits and pieces out for readability.
- keep track of global assignments and failed imports per
module; use this to determine whether the Y in "from X
import Y" is a submodule or just a global name. This is not
100% doable: you can't tell which symbols are imported when
doing a star import of a non-Python module short of actually
importing it.
- added a new method to ModuleFinder: any_missing_maybe(),
which returns *two* lists, one with certain misses, one with
possible misses. The possible misses are *very* often false
alarms, so it's useful to keep this list separate.
any_misses() now simply returns the union of
any_missing_maybe().
Tim Peters [Tue, 31 Dec 2002 16:01:47 +0000 (16:01 +0000)]
Removed the now-untrue (or soon-to-be untrue) part of the astimezone()
docs. Replaced it with an XXX block, because the hoped-for treatment
of DST endcases remains unclear (Guido doesn't really like raising an
exception when it's impossible to deliver a correct result, but so
far I have no way in hand to consistently deliver a defined incorrect
result either).
Andrew MacIntyre [Tue, 31 Dec 2002 11:18:08 +0000 (11:18 +0000)]
Build process updates:
- add new modules (zipimport, datetime, _random, bz2, _symtable)
- build pyexpat with expat sources from Python distribution
- regression test with and without compiled bytecode
Fred Drake [Tue, 31 Dec 2002 07:16:16 +0000 (07:16 +0000)]
Make sure PrettyPrinter methods that mirror the module-level
convenience functions isreadable() and isrecursive() work the same way
as the convenience functions.
Fred Drake [Tue, 31 Dec 2002 07:14:18 +0000 (07:14 +0000)]
- PrettyPrinter.isreadable(), .isrecursive():
Pass the right number of args to .format(). (Caught by
pychecker.)
- Protect the global namespace more carefully.
- Don't use the types module now that we don't need to.
Fred Drake [Tue, 31 Dec 2002 06:57:25 +0000 (06:57 +0000)]
Add a test that InterpolationError is constructed properly and raised
when expected. Only applies to the ConfigParser and SafeConfigParser
classes, not RawConfigParser.
Fred Drake [Tue, 31 Dec 2002 06:55:41 +0000 (06:55 +0000)]
ConfigParser._interpolate(): Pass the missing key to the
InterpolationError constructor, not the KeyError exception itself.
(Caught by the new InterpolationError test.)
SafeConfigParser._interpolate_some(): Pass the right number of
arguments to the InterpolationError constructor.
(Caught by pychecker.)