summaryrefslogtreecommitdiffstats
path: root/Modules/datetimemodule.c
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2003-01-02 19:35:54 (GMT)
committerTim Peters <tim.peters@gmail.com>2003-01-02 19:35:54 (GMT)
commit710fb1548ab43bcddc105c41b139b6328962de01 (patch)
tree7047ed7c552cb5cc43517e5b06dfbc7dee038a36 /Modules/datetimemodule.c
parent0123139d665c02fa731511d32a31724137c8eca0 (diff)
downloadcpython-710fb1548ab43bcddc105c41b139b6328962de01.zip
cpython-710fb1548ab43bcddc105c41b139b6328962de01.tar.gz
cpython-710fb1548ab43bcddc105c41b139b6328962de01.tar.bz2
astimezone() internals: if utcoffset() returns a duration, complain if
dst() returns None (instead of treating that as 0).
Diffstat (limited to 'Modules/datetimemodule.c')
-rw-r--r--Modules/datetimemodule.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c
index 3719a77..96c3e6d 100644
--- a/Modules/datetimemodule.c
+++ b/Modules/datetimemodule.c
@@ -4805,7 +4805,11 @@ datetimetz_astimezone(PyDateTime_DateTimeTZ *self, PyObject *args,
resdst = call_dst(tzinfo, result, &none);
if (resdst == -1 && PyErr_Occurred())
goto Fail;
- /* None and 0 dst() results are the same to us here. Debatable. */
+ if (none) {
+ PyErr_SetString(PyExc_ValueError, "astimezone(): utcoffset() "
+ "returned a duration but dst() returned None");
+ goto Fail;
+ }
total_added_to_result = resoff - resdst - selfoff;
if (total_added_to_result != 0) {
mm += total_added_to_result;