Re: [Python-Dev] try/except in io.py

2008-12-19 Thread Kristján Valur Jónsson
: Kristján Valur Jónsson Cc: Amaury Forgeot d'Arc; Python-Dev Subject: Re: [Python-Dev] try/except in io.py Generally speaking, close() and __delete__() methods that can be invoked during interpreter shutdown should avoid referencing module globals at all. Necessary globals (including members of

Re: [Python-Dev] try/except in io.py

2008-12-19 Thread Nick Coghlan
Kristján Valur Jónsson wrote: > Ah, but that is not what the intent is to guard agains, according the > comments. During exit, modules have been deleted and all sorts of > things have gone away. It is therefore likely that code that executes > during exit will encounter NameErrors (when a module is

Re: [Python-Dev] try/except in io.py

2008-12-19 Thread Kristján Valur Jónsson
> > 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 > >

Re: [Python-Dev] try/except in io.py

2008-12-19 Thread Amaury Forgeot d'Arc
Hello, Kristján Valur Jónsson wrote: > 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 ca

[Python-Dev] try/except in io.py

2008-12-19 Thread Kristján Valur Jónsson
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 checkin