Graham Dumpleton ha scritto: > [...] >> Here is the culprit: >> http://lists.alioth.debian.org/pipermail/python-modules-team/2009-January/003514.html >> http://code.google.com/p/modwsgi/issues/detail?id=82 >> >> So it seems safe, when the Log object used in wsgi.errors is also used >> to replace sys.stderr, to just add the closed attribute (but *not* the >> close method). > > It is all very silly. Technically a file like object is not required > to have a 'closed' attribute, so that code expecting it was wrong in > the first place. > > http://docs.python.org/library/stdtypes.html#file-objects >
Right, thanks; I did not notice it. Note however, that Mercurial has fixed the problem: # stderr may be buffered under win32 when redirected to files, # including stdout. if not getattr(sys.stderr, 'closed', False): sys.stderr.flush() I would probably do something like: try: sys.stderr.flush() except: pass > The close() method is however required of file like objects so if you > are going to replace a file like object, you should have it. > Yes, I should. But since they should raise an exception, raising AttributeError, instead, should not be a critical problem. Manlio _______________________________________________ Web-SIG mailing list Web-SIG@python.org Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com