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 salty-horse
Recipients salty-horse
Date 2019-01-15.10:18:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1547547515.11.0.919853628992.issue35743@roundup.psfhosted.org>
In-reply-to
Content
When an OSError exception is raised in __del__, both Python 2 and 3 print the "Exception ignored" message, but Python 3 also prints a traceback.

This is similar to issue 22836, with dealt with errors in __repr__ while inside __del__.

Test script:

import os

class Obj(object):
    def __init__(self):
        self.f = open('/dev/null')
        os.close(self.f.fileno())

    def __del__(self):
        self.f.close()

f = Obj()
del f

Output with Python 3.7.2:

Exception ignored in: <function Obj.__del__ at 0x7fb18789be18>
Traceback (most recent call last):
  File "/tmp/test.py", line 9, in __del__
    self.f.close()
OSError: [Errno 9] Bad file descriptor
History
Date User Action Args
2019-01-15 10:18:39salty-horsesetrecipients: + salty-horse
2019-01-15 10:18:35salty-horsesetmessageid: <1547547515.11.0.919853628992.issue35743@roundup.psfhosted.org>
2019-01-15 10:18:35salty-horselinkissue35743 messages
2019-01-15 10:18:35salty-horsecreate