Commit Graph

7255 Commits

Author SHA1 Message Date
Tim Peters 710fb1548a astimezone() internals: if utcoffset() returns a duration, complain if
dst() returns None (instead of treating that as 0).
2003-01-02 19:35:54 +00:00
Kurt B. Kaiser e23ca3c35a Improve exception handling. 2003-01-02 17:09:34 +00:00
Neal Norwitz b4a2df0c8d SF #660795
Add a test for logging from Vinay Sajip (module author)
2003-01-02 14:56:39 +00:00
Just van Rossum 109ecbf7a5 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 :-(.
2003-01-02 13:13:01 +00:00
Just van Rossum d35c6db526 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.
2003-01-02 12:55:48 +00:00
Andrew MacIntyre c6fff897d7 EMX fork() emulation not good enough to cope with test_socketserver 2003-01-02 12:49:00 +00:00
Anthony Baxter 4cedc1e84e 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.
2003-01-02 03:07:48 +00:00
Tim Peters f36151556f 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.
2003-01-01 21:51:37 +00:00
Neal Norwitz 4e8f5492c5 Revert last change -- test works on HPUX again after Martin's checkin
to 'properly configure the slave terminal'

See SF patch # 656590 for the details.
2003-01-01 14:53:27 +00:00
Martin v. Löwis 14e73b1864 Expose I_ constants. Auto-detect stropts.h. Properly configure the slave terminal. 2003-01-01 09:51:12 +00:00
Tim Peters 36087edc05 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).
2003-01-01 04:18:51 +00:00
Kurt B. Kaiser 50e9c4ff55 More installation info. Bump alpha version. 2003-01-01 01:14:13 +00:00
Kurt B. Kaiser 38f11101d8 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.
2003-01-01 00:26:41 +00:00
Kurt B. Kaiser 7cca3d8ef0 Improve exception handling. 2002-12-31 23:18:00 +00:00
Barry Warsaw b1dcbd223e Make two tests non-locale-dependent 2002-12-31 19:27:45 +00:00
Jeremy Hylton 1856541142 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).
2002-12-31 18:26:17 +00:00
Tony Lownds cf94ee817c Don't let the docstring end up in __main__.__doc__ 2002-12-31 18:22:37 +00:00
Barry Warsaw bc38baffbd test01_close_dbenv_before_db(): Added an XXX comment that this test is
BerkeleyDB version dependent.
2002-12-31 18:21:43 +00:00
Neal Norwitz 0aae2b07d7 Comment out test, since it hangs on HPUX, still investigating 2002-12-31 18:21:11 +00:00
Jeremy Hylton accb62b28e 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.
2002-12-31 18:17:44 +00:00
Kurt B. Kaiser 2cb540253b Update (slightly) for Alpha release 2002-12-31 18:12:04 +00:00
Martin v. Löwis 64aa5f6982 Remove bogus test; the master is not a terminal on Solaris and HP-UX. 2002-12-31 18:05:15 +00:00
Kurt B. Kaiser 085ce5a77a Move history to HISTORY.txt 2002-12-31 17:57:44 +00:00
Kurt B. Kaiser f5934dd5f8 Update for Alpha 0 Release 2002-12-31 17:56:18 +00:00
Tim Peters 521fc15e62 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.
2002-12-31 17:36:56 +00:00
Fred Drake e2c649126e 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.
2002-12-31 17:23:27 +00:00
Tony Lownds d8a6c5f4f4 Keep __main__ namespace clean 2002-12-31 16:52:44 +00:00
Just van Rossum e29310a2b3 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().

TODO: documentation, test_modulefinder.py
2002-12-31 16:33:00 +00:00
Just van Rossum 41c554fbec moving modulefinder.py to the standard library 2002-12-31 16:27:33 +00:00
Kurt B. Kaiser 6655e4bc27 Whitespace Normalization 2002-12-31 16:03:23 +00:00
Martin v. Löwis 96a60e4af5 Patch #658927: Add getctime to os.path.
Document that getatime and getmtime may return floats.
2002-12-31 13:11:54 +00:00
Andrew MacIntyre c70a8e411f OS/2 EMX has no popen2.Popen3 even though bunzip2 is available 2002-12-31 11:28:22 +00:00
Andrew MacIntyre fd07e7dda7 add list of expected skips for the OS/2 EMX port 2002-12-31 11:26:50 +00:00
Fred Drake b456e4f25b Make sure PrettyPrinter methods that mirror the module-level
convenience functions isreadable() and isrecursive() work the same way
as the convenience functions.
2002-12-31 07:16:16 +00:00
Fred Drake 397b615056 - 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.
2002-12-31 07:14:18 +00:00
Fred Drake 5478219e11 Add a test that InterpolationError is constructed properly and raised
when expected.  Only applies to the ConfigParser and SafeConfigParser
classes, not RawConfigParser.
2002-12-31 06:57:25 +00:00
Fred Drake 00dc5a93c1 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.)
2002-12-31 06:55:41 +00:00
Guido van Rossum 0146f419b4 Fix name error, found by pychecker. 2002-12-31 01:08:35 +00:00
Neal Norwitz d8b5e3fda1 Tix update from Mike Clarkson (maintainer) 2002-12-30 23:52:01 +00:00
Fred Drake 8d5dd98a2e - added InterpolationSyntaxError to __all__
- added docstring to exceptions
2002-12-30 23:51:45 +00:00
Neal Norwitz ce1d944b6b Add missing InterpolationSyntaxError.
XXX Not sure this is correct.
2002-12-30 23:38:47 +00:00
Neal Norwitz 6ec0a8ab93 sys was already imported, remove second import 2002-12-30 23:36:02 +00:00
Fred Drake a872595f31 - prefer "import ... as" to "import / (assignments) / del" for most things
- when the thread module isn't available, subsequent attempts to import
  threading should not suceed
2002-12-30 23:32:50 +00:00
Jack Jansen acda3394bb Updated the expected skips for MacOSX. 2002-12-30 23:03:13 +00:00
Jack Jansen 06f0cef1ca Skip this test on MacOSX: the locale support is too minimal to make
it pass.
2002-12-30 23:02:55 +00:00
Guido van Rossum a0934246d3 Use the dummy_thread module in Queue.py and tempfile.py.
tempfile.py already contained code to let it run without threads present;
for Queue.py this is considered a useful feature too.
2002-12-30 22:36:09 +00:00
Guido van Rossum ad50ca91a9 Brett Cannon's dummy_thread and dummy_threading modules (SF patch
622537), with some nitpicking editorial changes.
2002-12-30 22:30:22 +00:00
Neal Norwitz 5efc50d8af Fix SF #658820, regex fixes for _strptime (Brett Cannon)
Disallow zero for days and months
2002-12-30 22:23:12 +00:00
Jack Jansen 0940c6267a These were somehow never added to CVS. 2002-12-30 22:14:35 +00:00
Just van Rossum 52e14d640b PEP 302 + zipimport:
- new import hooks in import.c, exposed in the sys module
- new module called 'zipimport'
- various changes to allow bootstrapping from zip files

I hope I didn't break the Windows build (or anything else for that
matter), but then again, it's been sitting on sf long enough...

Regarding the latest discussions on python-dev: zipimport sets
pkg.__path__ as specified in PEP 273, and likewise, sys.path item such as
/path/to/Archive.zip/subdir/ are supported again.
2002-12-30 22:08:05 +00:00