Skip to content

Commit 07aa4d9

Browse files
committed
Revert inclusion of PACKRATDATA=backzone
Per python/tzdata#53 (comment) I chose to include backzone in pytz in an attempt to head off problems: Changes to past timestamps Finish moving to 'backzone' the location-based zones whose timestamps since 1970 are duplicates; adjust links accordingly. This change ordinarily affects only pre-1970 timestamps, and with the new PACKRATLIST option it does not affect any timestamps. In this round the affected zones are Antarctica/Vostok, Asia/Brunei, Asia/Kuala_Lumpur, Atlantic/Reykjavik, Europe/Amsterdam, Europe/Copenhagen, Europe/Luxembourg, Europe/Monaco, Europe/Oslo, Europe/Stockholm, Indian/Christmas, Indian/Cocos, Indian/Kerguelen, Indian/Mahe, Indian/Reunion, Pacific/Chuuk, Pacific/Funafuti, Pacific/Majuro, Pacific/Pohnpei, Pacific/Wake and Pacific/Wallis, and the affected links are Arctic/Longyearbyen, Atlantic/Jan_Mayen, Iceland, Pacific/Ponape, Pacific/Truk, and Pacific/Yap. This upstream change modifies some of the pre-1970 transitions in obscure ways that almost zero users will actually care about, and where quite likely dubious in any case. Such as the times pre-1970 when Belfast was not on London time or when Amsterdam switched from being 18-20 minutes ahead of GMT to GMT. Changes to historical timezones has always happened in the upstream database, and normally they are called corrections (which only causes breakage if you area storing wallclock times rather than UTC timestamps).
1 parent a5c6756 commit 07aa4d9

File tree

3 files changed

+4
-51
lines changed

3 files changed

+4
-51
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ upload_docs_pythonhosted: docs
142142
touch $@
143143

144144
.stamp-zoneinfo:
145-
${MAKE} -C ${IANA} ZFLAGS='-b fat' PACKRATDATA=backzone TOPDIR=`pwd`/build USRDIR= USRSHAREDIR=etc install
145+
${MAKE} -C ${IANA} ZFLAGS='-b fat' PACKRATDATA= TOPDIR=`pwd`/build USRDIR= USRSHAREDIR=etc install
146146
# Break hard links, working around http://bugs.python.org/issue8876.
147147
for d in zoneinfo zoneinfo-leaps zoneinfo-posix; do \
148148
rm -rf `pwd`/build/etc/$$d.tmp; \

src/README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Unfortunately using the tzinfo argument of the standard datetime
9191
constructors ''does not work'' with pytz for many timezones.
9292

9393
>>> datetime(2002, 10, 27, 12, 0, 0, tzinfo=amsterdam).strftime(fmt) # /!\ Does not work this way!
94-
'2002-10-27 12:00:00 LMT+0020'
94+
'2002-10-27 12:00:00 LMT+0018'
9595

9696
It is safe for timezones without daylight saving transitions though, such
9797
as UTC:

src/pytz/tests/test_tzinfo.py

+2-49
Original file line numberDiff line numberDiff line change
@@ -612,33 +612,6 @@ def test_arithmetic(self):
612612

613613
class LocalTestCase(unittest.TestCase):
614614
def testLocalize(self):
615-
loc_tz = pytz.timezone('Europe/Amsterdam')
616-
617-
loc_time = loc_tz.localize(datetime(1930, 5, 10, 0, 0, 0))
618-
# Actually +00:19:32, but Python datetime rounds this
619-
self.assertEqual(loc_time.strftime('%Z%z'), 'AMT+0020')
620-
621-
loc_time = loc_tz.localize(datetime(1930, 5, 20, 0, 0, 0))
622-
# Actually +00:19:32, but Python datetime rounds this
623-
self.assertEqual(loc_time.strftime('%Z%z'), 'NST+0120')
624-
625-
loc_time = loc_tz.localize(datetime(1940, 5, 10, 0, 0, 0))
626-
# pre-2017a, abbreviation was NCT
627-
self.assertEqual(loc_time.strftime('%Z%z'), '+0020+0020')
628-
629-
loc_time = loc_tz.localize(datetime(1940, 5, 20, 0, 0, 0))
630-
self.assertEqual(loc_time.strftime('%Z%z'), 'CEST+0200')
631-
632-
loc_time = loc_tz.localize(datetime(2004, 2, 1, 0, 0, 0))
633-
self.assertEqual(loc_time.strftime('%Z%z'), 'CET+0100')
634-
635-
loc_time = loc_tz.localize(datetime(2004, 4, 1, 0, 0, 0))
636-
self.assertEqual(loc_time.strftime('%Z%z'), 'CEST+0200')
637-
638-
loc_time = loc_tz.localize(datetime(1943, 3, 29, 1, 59, 59))
639-
self.assertEqual(loc_time.strftime('%Z%z'), 'CET+0100')
640-
641-
# Switch to US
642615
loc_tz = pytz.timezone('US/Eastern')
643616

644617
# End of DST ambiguity check
@@ -712,26 +685,6 @@ def testNormalize(self):
712685
'2004-04-04 01:50:00 EST-0500'
713686
)
714687

715-
def testPartialMinuteOffsets(self):
716-
# utcoffset in Amsterdam was not a whole minute until 1937
717-
# However, we fudge this by rounding them, as the Python
718-
# datetime library
719-
tz = pytz.timezone('Europe/Amsterdam')
720-
utc_dt = datetime(1914, 1, 1, 13, 40, 28, tzinfo=UTC) # correct
721-
utc_dt = utc_dt.replace(second=0) # But we need to fudge it
722-
loc_dt = utc_dt.astimezone(tz)
723-
self.assertEqual(
724-
loc_dt.strftime('%Y-%m-%d %H:%M:%S %Z%z'),
725-
'1914-01-01 14:00:00 AMT+0020'
726-
)
727-
728-
# And get back...
729-
utc_dt = loc_dt.astimezone(UTC)
730-
self.assertEqual(
731-
utc_dt.strftime('%Y-%m-%d %H:%M:%S %Z%z'),
732-
'1914-01-01 13:40:00 UTC+0000'
733-
)
734-
735688
def no_testCreateLocaltime(self):
736689
# It would be nice if this worked, but it doesn't.
737690
tz = pytz.timezone('Europe/Amsterdam')
@@ -759,8 +712,8 @@ def test_us_eastern(self):
759712

760713
def test_belfast(self):
761714
self.assertTrue('Europe/Belfast' in pytz.all_timezones_set)
762-
self.assertTrue('Europe/Belfast' in pytz.common_timezones)
763-
self.assertTrue('Europe/Belfast' in pytz.common_timezones_set)
715+
self.assertFalse('Europe/Belfast' in pytz.common_timezones)
716+
self.assertFalse('Europe/Belfast' in pytz.common_timezones_set)
764717

765718

766719
class ZoneCaseInsensitivityTestCase(unittest.TestCase):

0 commit comments

Comments
 (0)