Message333661
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 |
|
Date |
User |
Action |
Args |
2019-01-15 10:18:39 | salty-horse | set | recipients:
+ salty-horse |
2019-01-15 10:18:35 | salty-horse | set | messageid: <1547547515.11.0.919853628992.issue35743@roundup.psfhosted.org> |
2019-01-15 10:18:35 | salty-horse | link | issue35743 messages |
2019-01-15 10:18:35 | salty-horse | create | |
|