Skip to content

Commit 00cb426

Browse files
authored
Merge pull request #41 from pganssle/fix_fold_inconsistency
Fix fold inconsistency
2 parents ae39926 + bfc87e6 commit 00cb426

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

Diff for: lib/zoneinfo_module.c

+7-4
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ utcoff_to_dstoff(size_t *trans_idx, long *utcoffs, long *dstoffs,
9696
size_t num_ttinfos);
9797
static int
9898
ts_to_local(size_t *trans_idx, int64_t *trans_utc, long *utcoff,
99-
int64_t *trans_local[2], size_t num_transitions);
99+
int64_t *trans_local[2], size_t num_ttinfos,
100+
size_t num_transitions);
100101

101102
static int
102103
parse_tz_str(PyObject *tz_str_obj, _tzrule *out);
@@ -906,7 +907,8 @@ load_data(PyZoneInfo_ZoneInfo *self, PyObject *file_obj)
906907
self->num_ttinfos);
907908

908909
if (ts_to_local(trans_idx, self->trans_list_utc, utcoff,
909-
self->trans_list_wall, self->num_transitions)) {
910+
self->trans_list_wall, self->num_ttinfos,
911+
self->num_transitions)) {
910912
goto error;
911913
}
912914

@@ -1931,7 +1933,8 @@ utcoff_to_dstoff(size_t *trans_idx, long *utcoffs, long *dstoffs,
19311933
*/
19321934
static int
19331935
ts_to_local(size_t *trans_idx, int64_t *trans_utc, long *utcoff,
1934-
int64_t *trans_local[2], size_t num_transitions)
1936+
int64_t *trans_local[2], size_t num_ttinfos,
1937+
size_t num_transitions)
19351938
{
19361939
if (num_transitions == 0) {
19371940
return 0;
@@ -1948,7 +1951,7 @@ ts_to_local(size_t *trans_idx, int64_t *trans_utc, long *utcoff,
19481951
}
19491952

19501953
int64_t offset_0, offset_1, buff;
1951-
if (num_transitions > 1) {
1954+
if (num_ttinfos > 1) {
19521955
offset_0 = utcoff[0];
19531956
offset_1 = utcoff[trans_idx[0]];
19541957

Diff for: tests/data/zoneinfo_data.json

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
{
2+
"Africa/Abidjan": [
3+
"{Wp48S^xk9=GL@E0stWa761SMbT8$j-~f{VGF<>F7KxBg5R*{Ksocg8-YYVul=v7vZzaHN",
4+
"uC=da5UI2rH18c!OnjV{y4u(+A!!VBKmY&$ORw>7UO^(500B;v0RR91bXh%WvBYQl0ssI2",
5+
"00dcD"
6+
],
27
"Africa/Casablanca": [
38
"{Wp48S^xk9=GL@E0stWa761SMbT8$j;0b&K$Xx&`7KxBg5R*{N&yjMUR~;C-fDaSOU;q-~",
49
"FqW+4{YBjbcw}`a!dW>b)R2-0a+uwf`P3{_Y@HuCz}S$J$ZJ>R_V<~|Fk>sgX4=%0vUrh-",

Diff for: tests/test_zoneinfo.py

+9
Original file line numberDiff line numberDiff line change
@@ -1610,6 +1610,14 @@ def _get_zonedump(cls):
16101610

16111611
@classmethod
16121612
def _populate_zonedump_data(cls):
1613+
def _Africa_Abidjan():
1614+
LMT = ZoneOffset("LMT", timedelta(seconds=-968))
1615+
GMT = ZoneOffset("GMT", ZERO)
1616+
1617+
return [
1618+
ZoneTransition(datetime(1912, 1, 1), LMT, GMT),
1619+
]
1620+
16131621
def _Africa_Casablanca():
16141622
P00_s = ZoneOffset("+00", ZERO, ZERO)
16151623
P01_d = ZoneOffset("+01", ONE_H, ONE_H)
@@ -1760,6 +1768,7 @@ def _Pacific_Kiritimati():
17601768
]
17611769

17621770
cls._ZONEDUMP_DATA = {
1771+
"Africa/Abidjan": _Africa_Abidjan(),
17631772
"Africa/Casablanca": _Africa_Casablanca(),
17641773
"America/Los_Angeles": _America_Los_Angeles(),
17651774
"America/Santiago": _America_Santiago(),

0 commit comments

Comments
 (0)