New submission from Ori Avtalion <[email protected]>:
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
----------
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 <[email protected]>
<https://bugs.python.org/issue35743>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com