summaryrefslogtreecommitdiffstats
path: root/Lib/aifc.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/aifc.py')
-rw-r--r--Lib/aifc.py19
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: