This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients vstinner
Date 2019-06-10.23:45:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1560210319.85.0.887484202288.issue37223@roundup.psfhosted.org>
In-reply-to
Content
bpo-18748 modified io.IOBase finalizer to no longer silence close() exception in develoment and in debug mode.

The commit 472f794a33221ea835a2fbf6c9f12aa2bd66d1b0 fixed a few destructor errors in test_io, but there are still a few:

test_uninitialized (test.test_io.PyBufferedReaderTest) ...
Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 814, in close
    if self.raw is not None and not self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 836, in raw
    return self._raw
AttributeError: 'BufferedReader' object has no attribute '_raw'
ok

test_max_buffer_size_removal (test.test_io.PyBufferedWriterTest) ...
Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1299, in close
    with self._write_lock:
AttributeError: 'BufferedWriter' object has no attribute '_write_lock'
ok

test_misbehaved_io (test.test_io.PyBufferedWriterTest) ...
Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1308, in close
    self.flush()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1269, in flush
    self._flush_unlocked()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1285, in _flush_unlocked
    raise OSError("write() returned incorrect number of bytes")
OSError: write() returned incorrect number of bytes
ok

test_uninitialized (test.test_io.PyBufferedWriterTest) ...
Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1299, in close
    with self._write_lock:
AttributeError: 'BufferedWriter' object has no attribute '_write_lock'
ok

test_writer_close_error_on_close (test.test_io.CBufferedRWPairTest) ...
Exception ignored in: <_io.BufferedWriter>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/unittest/case.py", line 611, in _callTestMethod
    method()
ValueError: flush of closed file
ok

test_constructor_max_buffer_size_removal (test.test_io.PyBufferedRWPairTest) ...
Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1377, in close
    self.reader.close()
AttributeError: 'BufferedRWPair' object has no attribute 'reader'
ok

test_constructor_with_not_readable (test.test_io.PyBufferedRWPairTest) ...
Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1377, in close
    self.reader.close()
AttributeError: 'BufferedRWPair' object has no attribute 'reader'
ok

test_constructor_with_not_writeable (test.test_io.PyBufferedRWPairTest) ...
Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1377, in close
    self.reader.close()
AttributeError: 'BufferedRWPair' object has no attribute 'reader'
ok

test_isatty (test.test_io.PyBufferedRWPairTest) ...
Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1377, in close
    self.reader.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 814, in close
    if self.raw is not None and not self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 840, in closed
    return self.raw.closed
AttributeError: 'SelectableIsAtty' object has no attribute 'closed'

Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 814, in close
    if self.raw is not None and not self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 840, in closed
    return self.raw.closed
AttributeError: 'SelectableIsAtty' object has no attribute 'closed'

Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1300, in close
    if self.raw is None or self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 840, in closed
    return self.raw.closed
AttributeError: 'SelectableIsAtty' object has no attribute 'closed'

Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1377, in close
    self.reader.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 814, in close
    if self.raw is not None and not self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 840, in closed
    return self.raw.closed
AttributeError: 'SelectableIsAtty' object has no attribute 'closed'

Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 814, in close
    if self.raw is not None and not self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 840, in closed
    return self.raw.closed
AttributeError: 'SelectableIsAtty' object has no attribute 'closed'

Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1300, in close
    if self.raw is None or self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 840, in closed
    return self.raw.closed
AttributeError: 'SelectableIsAtty' object has no attribute 'closed'

Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1377, in close
    self.reader.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 814, in close
    if self.raw is not None and not self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 840, in closed
    return self.raw.closed
AttributeError: 'SelectableIsAtty' object has no attribute 'closed'

Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 814, in close
    if self.raw is not None and not self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 840, in closed
    return self.raw.closed
AttributeError: 'SelectableIsAtty' object has no attribute 'closed'

Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1300, in close
    if self.raw is None or self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 840, in closed
    return self.raw.closed
AttributeError: 'SelectableIsAtty' object has no attribute 'closed'

Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1377, in close
    self.reader.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 814, in close
    if self.raw is not None and not self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 840, in closed
    return self.raw.closed
AttributeError: 'SelectableIsAtty' object has no attribute 'closed'

Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 814, in close
    if self.raw is not None and not self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 840, in closed
    return self.raw.closed
AttributeError: 'SelectableIsAtty' object has no attribute 'closed'

Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1300, in close
    if self.raw is None or self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 840, in closed
    return self.raw.closed
AttributeError: 'SelectableIsAtty' object has no attribute 'closed'
ok

test_uninitialized (test.test_io.PyBufferedRWPairTest) ...
Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1377, in close
    self.reader.close()
AttributeError: 'BufferedRWPair' object has no attribute 'reader'
ok

test_destructor (test.test_io.CBufferedRandomTest) ...
Exception ignored in: <_io.BufferedRWPair object at 0x7f2f3c5842f0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/test/support/__init__.py", line 1627, in gc_collect
    gc.collect()
ValueError: flush of closed file

Exception ignored in: <_io.BufferedWriter>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/test/support/__init__.py", line 1627, in gc_collect
    gc.collect()
ValueError: flush of closed file
ok

test_misbehaved_io (test.test_io.CBufferedRandomTest) ...
Exception ignored in: <_io.BufferedRandom>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/test/test_io.py", line 2306, in test_misbehaved_io
    BufferedReaderTest.test_misbehaved_io(self)
OSError: Raw stream returned invalid position -123

Exception ignored in: <_io.BufferedRandom>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/test/test_io.py", line 2307, in test_misbehaved_io
    BufferedWriterTest.test_misbehaved_io(self)
OSError: Raw stream returned invalid position -123
ok

test_write_non_blocking (test.test_io.CBufferedRandomTest) ...
Exception ignored in: <_io.BufferedRandom>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/unittest/case.py", line 611, in _callTestMethod
    method()
io.UnsupportedOperation: seek
ok

test_max_buffer_size_removal (test.test_io.PyBufferedRandomTest) ...
Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1299, in close
    with self._write_lock:
AttributeError: 'BufferedRandom' object has no attribute '_write_lock'
ok

test_misbehaved_io (test.test_io.PyBufferedRandomTest) ...
Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1308, in close
    self.flush()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1269, in flush
    self._flush_unlocked()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1285, in _flush_unlocked
    raise OSError("write() returned incorrect number of bytes")
OSError: write() returned incorrect number of bytes
ok

test_uninitialized (test.test_io.PyBufferedRandomTest) ...
Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1299, in close
    with self._write_lock:
AttributeError: 'BufferedRandom' object has no attribute '_write_lock'

Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 1299, in close
    with self._write_lock:
AttributeError: 'BufferedRandom' object has no attribute '_write_lock'
ok

test_destructor (test.test_io.PyTextIOWrapperTest) ...
Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/test/test_io.py", line 2817, in close
    l.append(self.getvalue())
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 896, in getvalue
    raise ValueError("getvalue on closed file")
ValueError: getvalue on closed file
ok

test_issue22849 (test.test_io.PyTextIOWrapperTest) ...
Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 2161, in close
    if self.buffer is not None and not self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 2169, in closed
    return self.buffer.closed
AttributeError: 'F' object has no attribute 'closed'

Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 2161, in close
    if self.buffer is not None and not self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 2169, in closed
    return self.buffer.closed
AttributeError: 'F' object has no attribute 'closed'

Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 2161, in close
    if self.buffer is not None and not self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 2169, in closed
    return self.buffer.closed
AttributeError: 'F' object has no attribute 'closed'

Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 2161, in close
    if self.buffer is not None and not self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 2169, in closed
    return self.buffer.closed
AttributeError: 'F' object has no attribute 'closed'

Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 2161, in close
    if self.buffer is not None and not self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 2169, in closed
    return self.buffer.closed
AttributeError: 'F' object has no attribute 'closed'

Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 2161, in close
    if self.buffer is not None and not self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 2169, in closed
    return self.buffer.closed
AttributeError: 'F' object has no attribute 'closed'

Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 2161, in close
    if self.buffer is not None and not self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 2169, in closed
    return self.buffer.closed
AttributeError: 'F' object has no attribute 'closed'

Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 2161, in close
    if self.buffer is not None and not self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 2169, in closed
    return self.buffer.closed
AttributeError: 'F' object has no attribute 'closed'

Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 2161, in close
    if self.buffer is not None and not self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 2169, in closed
    return self.buffer.closed
AttributeError: 'F' object has no attribute 'closed'

Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 2161, in close
    if self.buffer is not None and not self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 2169, in closed
    return self.buffer.closed
AttributeError: 'F' object has no attribute 'closed'

Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 2161, in close
    if self.buffer is not None and not self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 2169, in closed
    return self.buffer.closed
AttributeError: 'F' object has no attribute 'closed'
ok

test_repr (test.test_io.PyTextIOWrapperTest) ...
Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 2161, in close
    if self.buffer is not None and not self.closed:
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 2169, in closed
    return self.buffer.closed
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 840, in closed
    return self.raw.closed
AttributeError: 'NoneType' object has no attribute 'closed'
ok


List of failing tests:

test.test_io.CBufferedRWPairTest.test_writer_close_error_on_close
test.test_io.CBufferedRandomTest.test_destructor
test.test_io.CBufferedRandomTest.test_misbehaved_io
test.test_io.CBufferedRandomTest.test_write_non_blocking
test.test_io.PyBufferedRWPairTest.test_constructor_max_buffer_size_removal
test.test_io.PyBufferedRWPairTest.test_constructor_with_not_readable
test.test_io.PyBufferedRWPairTest.test_constructor_with_not_writeable
test.test_io.PyBufferedRWPairTest.test_isatty
test.test_io.PyBufferedRWPairTest.test_uninitialized
test.test_io.PyBufferedRandomTest.test_max_buffer_size_removal
test.test_io.PyBufferedRandomTest.test_misbehaved_io
test.test_io.PyBufferedRandomTest.test_uninitialized
test.test_io.PyBufferedReaderTest.test_uninitialized
test.test_io.PyBufferedWriterTest.test_max_buffer_size_removal
test.test_io.PyBufferedWriterTest.test_misbehaved_io
test.test_io.PyBufferedWriterTest.test_uninitialized
test.test_io.PyTextIOWrapperTest.test_destructor
test.test_io.PyTextIOWrapperTest.test_issue22849
test.test_io.PyTextIOWrapperTest.test_repr
History
Date User Action Args
2019-06-10 23:45:19vstinnersetrecipients: + vstinner
2019-06-10 23:45:19vstinnersetmessageid: <1560210319.85.0.887484202288.issue37223@roundup.psfhosted.org>
2019-06-10 23:45:19vstinnerlinkissue37223 messages
2019-06-10 23:45:19vstinnercreate