diff options
author | Guido van Rossum <guido@python.org> | 1993-06-20 21:02:22 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1993-06-20 21:02:22 (GMT) |
commit | 9b3bc715980b51ffbf535bcf159ba4be03938c19 (patch) | |
tree | bac82c0ba89639c54234f789ae862e6b1b4329ee /Lib/aifc.py | |
parent | 52fc1f607eab013b1e7688b4cfb3b09fb82ce9eb (diff) | |
download | cpython-9b3bc715980b51ffbf535bcf159ba4be03938c19.zip cpython-9b3bc715980b51ffbf535bcf159ba4be03938c19.tar.gz cpython-9b3bc715980b51ffbf535bcf159ba4be03938c19.tar.bz2 |
* aifc.py: don't die on invalid MARK chunk
* calendar.py: remove stuff now built in time; some cleanup and
generalization in the calendar printing
* cmd.py: use __init__.
* tzparse.py: This module is no longer necessary -- use builtin time instead!
Diffstat (limited to 'Lib/aifc.py')
-rw-r--r-- | Lib/aifc.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/Lib/aifc.py b/Lib/aifc.py index 8c04ea3..7bdb9f0 100644 --- a/Lib/aifc.py +++ b/Lib/aifc.py @@ -563,11 +563,20 @@ class Aifc_read: def _readmark(self, chunk): nmarkers = _read_short(chunk) - for i in range(nmarkers): - id = _read_short(chunk) - pos = _read_long(chunk) - name = _read_string(chunk) - self._markers.append((id, pos, name)) + # Some files appear to contain invalid counts. + # Cope with this by testing for EOF. + try: + for i in range(nmarkers): + id = _read_short(chunk) + pos = _read_long(chunk) + name = _read_string(chunk) + self._markers.append((id, pos, name)) + except EOFError: + print 'Warning: MARK chunk contains only', + print len(self._markers), + if len(self._markers) == 1: print 'marker', + else: print 'markers', + print 'instead of', nmarkers class Aifc_write: # Variables used in this class: |