[Web-SIG] wsgi.errors and close method
manlio_perillo at libero.it
Tue Mar 30 11:28:07 CEST 2010
Graham Dumpleton ha scritto:
>> Here is the culprit:
>> 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.
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):
I would probably do something like:
> 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.
More information about the Web-SIG