Ticket #13299: Handle-timezone-files-with-no-modern-transitions-as-well_fixes_30_master.patch

File Handle-timezone-files-with-no-modern-transitions-as-well_fixes_30_master.patch, 1.1 KB (added by rcrdnalor, 6 weeks ago)

Patch for master and fixes/30: Note: The '0001-python-Handle-massively-negative-initial-zoneinfo-en.patch' is already applied on there.

  • mythtv/bindings/python/MythTV/utility/dt.py

    diff --git a/mythtv/bindings/python/MythTV/utility/dt.py b/mythtv/bindings/python/MythTV/utility/dt.py
    index c4c128b1cb..3f411406d7 100644
    a b class posixtzinfo( basetzinfo ): 
    163163        # files have massively negative leading entries for e.g. the
    164164        # big bang which gmtime() cannot cope with.
    165165        first_modern_transition = None
     166        i = 0   # assign i, in case the for-loop is not executed:
    166167        for i in range(counts.transitions):  # read in epoch time data
    167168            t = unpack(ttmfmt, fd.read(calcsize(ttmfmt)))[0]
    168169
    class posixtzinfo( basetzinfo ): 
    177178                if first_modern_transition is not None:
    178179                    raise e
    179180
     181        # Special case if there are no modern transitions, like e.g. UTC timezone:
     182        if ( (i == 0) and first_modern_transition is None ):
     183            first_modern_transition = counts.transitions
     184
    180185        # read in transition type indexes
    181186        types = [None]*counts.transitions
    182187        for i in range(counts.transitions):