]> granicus.if.org Git - python/commit
Issue #29507: Update test_exceptions
authorVictor Stinner <victor.stinner@gmail.com>
Thu, 9 Feb 2017 22:49:50 +0000 (23:49 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Thu, 9 Feb 2017 22:49:50 +0000 (23:49 +0100)
commit331bbe6aaa74f8d28f27b79e8c6a0c35dbe9a6ab
tree9b5a759d220e3249012b7496affe9ba47e36e240
parent516b98161a0e88fde85145ead571e13394215f8c
Issue #29507: Update test_exceptions

test_unraisable() of test_exceptions expects that PyErr_WriteUnraisable(method)
fails on repr(method).

Before the previous change (7b8df4a5d81d), slot_tp_finalize() called
PyErr_WriteUnraisable() with a PyMethodObject. In this case, repr(method) calls
repr(self) which is BrokenRepr.__repr__() and the calls raises a new exception.

After the previous change, slot_tp_finalize() uses an unbound method: repr() is
called on a regular __del__() method which doesn't call repr(self). repr()
doesn't fail anymore.

PyErr_WriteUnraisable() doesn't call __repr__() anymore, so remove BrokenRepr
unit test.
Lib/test/test_exceptions.py