2011/1/11 Armin Rigo <[email protected]>:
> The secondary problem that we have is what to do when file.__del__
> gets an exception from calling close(). Is it ok to just ignore it?
> FWIW in CPython, file.__del__ also prints an error message if close()
> raises an exception. So from that point of view there is nothing to
> fix in PyPy, apart maybe making the error message a bit more explicit
> (CPython prints "close failed in file object destructor:...").
The io module chose to silence the error;
I suggest to do the same, even if the reasoning is different
from the comment below::
class IOBase:
def __del__(self):
"""Destructor. Calls close()."""
# The try/except block is in case this is called at program
# exit time, when it's possible that globals have already been
# deleted, and then the close() call might fail. Since
# there's nothing we can do about such failures and they annoy
# the end users, we suppress the traceback.
try:
self.close()
except:
pass
--
Amaury Forgeot d'Arc
_______________________________________________
[email protected]
http://codespeak.net/mailman/listinfo/pypy-dev