[issue1545463] New-style classes fail to cleanup attributes
Richard Oudkerk
report at bugs.python.org
Tue May 7 20:42:57 CEST 2013
Richard Oudkerk added the comment:
I think the problem is that the __del__ method fails on Windows, maybe because sys.stdout and sys.__stderr__ have been replaced by None.
Consider the following program:
import os
class C:
def __del__(self, write=os.write):
write(1, b"BEFORE\n")
print("__del__ called")
write(1, b"AFTER\n")
l = [C()]
l.append(l)
On Unix I get
BEFORE
__del__ called
AFTER
but on Windows I only get
BEFORE
I would suggest using os.write() instead of print() in the tests.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1545463>
_______________________________________
More information about the Python-bugs-list
mailing list