diff -r 6a599249e8b7 Lib/aifc.py --- a/Lib/aifc.py Sat Nov 16 13:04:00 2013 +0200 +++ b/Lib/aifc.py Sat Nov 16 13:42:42 2013 +0200 @@ -788,7 +788,10 @@ self._datalength = (self._datalength + 3) // 4 if self._datalength & 1: self._datalength = self._datalength + 1 - self._form_length_pos = self._file.tell() + try: + self._form_length_pos = self._file.tell() + except (AttributeError, OSError): + self._form_length_pos = None commlength = self._write_form_length(self._datalength) if self._aifc: self._file.write(b'AIFC') @@ -800,7 +803,8 @@ self._file.write(b'COMM') _write_ulong(self._file, commlength) _write_short(self._file, self._nchannels) - self._nframes_pos = self._file.tell() + if self._form_length_pos is not None: + self._nframes_pos = self._file.tell() _write_ulong(self._file, self._nframes) if self._comptype in (b'ULAW', b'ulaw', b'ALAW', b'alaw', b'G722'): _write_short(self._file, 8) @@ -811,7 +815,8 @@ self._file.write(self._comptype) _write_string(self._file, self._compname) self._file.write(b'SSND') - self._ssnd_length_pos = self._file.tell() + if self._form_length_pos is not None: + self._ssnd_length_pos = self._file.tell() _write_ulong(self._file, self._datalength + 8) _write_ulong(self._file, 0) _write_ulong(self._file, 0) diff -r 6a599249e8b7 Lib/test/test_aifc.py --- a/Lib/test/test_aifc.py Sat Nov 16 13:04:00 2013 +0200 +++ b/Lib/test/test_aifc.py Sat Nov 16 13:42:42 2013 +0200 @@ -13,9 +13,6 @@ module = aifc close_fd = True test_unseekable_read = None - test_unseekable_write = None - test_unseekable_incompleted_write = None - test_unseekable_overflowed_write = None class AifcPCM8Test(AifcTest, unittest.TestCase):