diff options
author | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2015-09-06 17:07:21 (GMT) |
---|---|---|
committer | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2015-09-06 17:07:21 (GMT) |
commit | 7827a5b7c29ae71daf0175ce3398115374ceb50e (patch) | |
tree | 275c926de9cbabbcd65ba73ea0599d1fe0aafeb3 /Modules/_datetimemodule.c | |
parent | 40dc328cc2b51a008dd303776e6f7529260ddf15 (diff) | |
download | cpython-7827a5b7c29ae71daf0175ce3398115374ceb50e.zip cpython-7827a5b7c29ae71daf0175ce3398115374ceb50e.tar.gz cpython-7827a5b7c29ae71daf0175ce3398115374ceb50e.tar.bz2 |
Closes Issue#22241: timezone.utc name is now plain 'UTC', not 'UTC-00:00'.
Diffstat (limited to 'Modules/_datetimemodule.c')
-rw-r--r-- | Modules/_datetimemodule.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c index ae459df..008b733 100644 --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -3267,6 +3267,11 @@ timezone_str(PyDateTime_TimeZone *self) Py_INCREF(self->name); return self->name; } + if (self == PyDateTime_TimeZone_UTC || + (GET_TD_DAYS(self->offset) == 0 && + GET_TD_SECONDS(self->offset) == 0 && + GET_TD_MICROSECONDS(self->offset) == 0)) + return PyUnicode_FromString("UTC"); /* Offset is normalized, so it is negative if days < 0 */ if (GET_TD_DAYS(self->offset) < 0) { sign = '-'; |