Irit Katriel <[email protected]> added the comment:
I think this issue is out of date.
For Mihai's example I get:
>>> class A(object):
... def __init__(self):
... raise Exception('init error')
... self.m = 'Hello world'
... def __del__(self):
... #raise RuntimeError('my runtime error')
... self.__del__()
...
>>> def func():
... h = A()
...
>>> func()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 2, in func
File "<stdin>", line 3, in __init__
Exception: init error
>>>
For Amaury's first example I get what I expect:
>>> class A:
... def close(self):
... self.close()
... def __del__(self):
... self.close()
...
>>> class A:
... def close(self):
... self.close()
... def __del__(self):
... self.close()
...
>>> def func():
... h = A()
...
>>> func()
Exception ignored in: <function A.__del__ at 0x000002921A8E1820>
Traceback (most recent call last):
File "<stdin>", line 5, in __del__
File "<stdin>", line 3, in close
File "<stdin>", line 3, in close
File "<stdin>", line 3, in close
[Previous line repeated 994 more times]
RecursionError: maximum recursion depth exceeded
>>>
And for Amaury's trashcan example (even when I increase the list length to well
over the trashcan threshold):
>>> class C:
... def __del__(self):
... print('.')
... x = self
... for i in range(49): # PyTrash_UNWIND_LEVEL-1
... x = [x]
...
>>> l = [C()]
>>> del l
.
>>> class C:
... def __del__(self):
... print('.')
... x = self
... for i in range(5000):
... x = [x]
...
>>> l = [C()]
>>> del l
.
>>>
----------
nosy: +iritkatriel
resolution: -> out of date
status: open -> pending
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue10794>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com