summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2002-12-31 17:36:56 (GMT)
committerTim Peters <tim.peters@gmail.com>2002-12-31 17:36:56 (GMT)
commit521fc15e626ed53ba90c966c4a2392ab487fd62e (patch)
tree586b22e2773638958fe158c29a04d41d1af179e1 /Misc
parentba2f875d90c5b8650d6bde2a152be8f899e15469 (diff)
downloadcpython-521fc15e626ed53ba90c966c4a2392ab487fd62e.zip
cpython-521fc15e626ed53ba90c966c4a2392ab487fd62e.tar.gz
cpython-521fc15e626ed53ba90c966c4a2392ab487fd62e.tar.bz2
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.
Diffstat (limited to 'Misc')
0 files changed, 0 insertions, 0 deletions