[Web-SIG] wsgi.errors and close method

Graham Dumpleton graham.dumpleton at gmail.com
Sun Mar 28 13:49:59 CEST 2010


On 28 March 2010 22:21, Manlio Perillo <manlio_perillo at libero.it> wrote:
> Graham Dumpleton ha scritto:
>> [...]
>>> Unfortunately I never got to know what application or framework was
>>> causing the problem.
>>>
>>> Any idea?
>>
>
> Sorry, my question was not clear.
>
> I was asking what applications or frameworks call the .close method on
> the errors object.

I know what you were asking. My point was that it doesn't help to find
out as nearly impossible to get them to change the code. I have tried
that with a few different packages where there use of sys.stdin and
sys.stdout was questionable within context of WSGI. It is a loosing
battle. You just need to make your code tolerant to such possible
abuses.

> I want to check if:
> * they are really calling the .close method on wsgi.errors, and why
> * they are calling the .close method on stderr, and why
>
>
>> [...]
>> static PyGetSetDef Log_getset[] = {
>>     { "closed", (getter)Log_closed, NULL, 0 },
>> #if PY_MAJOR_VERSION < 3
>>     { "softspace", (getter)Log_get_softspace, (setter)Log_set_softspace, 0 },
>> #else
>
> I noted that you added softspace descriptor in recent versions.
> What is its purpose?
> Is it here just for compatibility?

It is related to how comma separated lists and comma at end of line is
used in the following.

  print >> sys.stderr, "a", "b",
  print >> sys.stderr, "c"

>From memory with out softspace attribute you will not get spaces
between things when using that syntax for output formatting.

I can't remember exact details and don't have time right now to see if
I had an issue in bug tracker about it or how much I documented it in
change files.

Graham


More information about the Web-SIG mailing list