[New-bugs-announce] [issue35743] Broken "Exception ignored in:" message on OSError's

Ori Avtalion report at bugs.python.org
Tue Jan 15 05:18:35 EST 2019

New submission from Ori Avtalion <ori at avtalion.name>:

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')

    def __del__(self):

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__
OSError: [Errno 9] Bad file descriptor

components: Interpreter Core
messages: 333661
nosy: salty-horse
priority: normal
severity: normal
status: open
title: Broken "Exception ignored in:" message on OSError's
versions: Python 3.6, Python 3.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list