summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2003-01-22 04:45:50 (GMT)
committerTim Peters <tim.peters@gmail.com>2003-01-22 04:45:50 (GMT)
commitf196a0a4dde4327dddda49c194ca5cc28c0db1f5 (patch)
treef9735bce70d213cc52dd279324c65debd6a42fa6 /Misc
parent51f3f1b7dce6d054891faf9959fc493e66e9f684 (diff)
downloadcpython-f196a0a4dde4327dddda49c194ca5cc28c0db1f5.zip
cpython-f196a0a4dde4327dddda49c194ca5cc28c0db1f5.tar.gz
cpython-f196a0a4dde4327dddda49c194ca5cc28c0db1f5.tar.bz2
"Premature" doc changes, for new astimezone() rules, and the new
tzinfo.fromutc() method. The C code doesn't implement any of this yet (well, not the C code on the machine I'm using now), nor does the test suite reflect it. The Python datetime.py implementation and test suite in the sandbox do match these doc changes. The C implementation probably won't catch up before Thursday (Wednesday is a scheduled "black hole" day this week <0.4 wink>).
Diffstat (limited to 'Misc')
-rw-r--r--Misc/NEWS22
1 files changed, 19 insertions, 3 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 349712f..0d49bf8 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -45,7 +45,7 @@ Extension modules
microsecond <http://www.python.org/sf/661086>. This repairs an
irritation most likely seen on Windows systems.
- In dt.asdatetime(tz), if tz.utcoffset(dt) returns a duration,
+ In dt.astimezone(tz), if tz.utcoffset(dt) returns a duration,
ValueError is raised if tz.dst(dt) returns None (2.3a1 treated it
as 0 instead, but a tzinfo subclass wishing to participate in
time zone conversion has to take a stand on whether it supports
@@ -60,11 +60,27 @@ Extension modules
The example tzinfo class for local time had a bug. It was replaced
by a later example coded by Guido.
- datetimetz.astimezone(tz) no longer raises an exception when the
+ datetime.astimezone(tz) no longer raises an exception when the
input datetime has no UTC equivalent in tz. For typical "hybrid" time
zones (a single tzinfo subclass modeling both standard and daylight
time), this case can arise one hour per year, at the hour daylight time
- ends. See new docs for details.
+ ends. See new docs for details. In short, the new behavior mimics
+ the local wall clock's behavior of repeating an hour in local time.
+
+ dt.astimezone() can no longer be used to convert between naive and aware
+ datetime objects. If you merely want to attach, or remove, a tzinfo
+ object, without any conversion of date and time members, use
+ dt.replace(tzinfo=whatever) instead, where "whatever" is None or a
+ tzinfo subclass instance.
+
+ A new method tzinfo.fromutc(dt) can be overridden in tzinfo subclasses
+ to give complete control over how a UTC time is to be converted to
+ a local time. The default astimezone() implementation calls fromutc()
+ as its last step, so a tzinfo subclass can affect that too by overriding
+ fromutc(). It's expected that the default fromutc() implementation will
+ be suitable as-is for "almost all" time zone subclasses, but the
+ creativity of political time zone fiddling appears unbounded -- fromutc()
+ allows the highly motivated to emulate any scheme expressible in Python.
The constructors building a datetime from a timestamp could raise
ValueError if the platform C localtime()/gmtime() inserted "leap