Greetings!

Yesterday, I committed revision r67843 to py3k.
Re-enablign the windows CRT runtime checks showed me that close() was beeing 
called with an invalid file descriptor.
Now, the problem was was in tokenizer.c, but the reason this wasn't caught 
earlier was,

1)      Incorrect error checking for close() in _fileio.c, which I fixed, and

2)      Line 384 in io.py, where all exceptions are caught for self.close().

Fixing 1 and patching 2 would bring the problem to light when running the 
test_imp.py part of the testsuite and, indeed, applying the fix to tokenizer.c 
would then remove it again.

I am a bit worried about 2) thoug.  I didn't modify that, but having a catch 
all clause just to be clean on system exit seems shaky to me.   I wonder, is 
there a way to make such behaviour, if it is indeed necessary, just to be 
active when exit is in progress?

Something like:
try:
                self.close()
except:
                try:
                               if not sys.exiting(): raise
                except:
                               pass


Or better yet, do as we have done often here, just catch the particular problem 
that occurs during shutdown, most often name error:
try:
                self.close()
except (AttributeError, NameError):
                pass


What do you think?
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to