[Web-SIG] some questions about start_response implementation
Phillip J. Eby
pje at telecommunity.com
Mon Oct 15 18:11:39 CEST 2007
At 05:52 PM 10/15/2007 +0200, Manlio Perillo wrote:
>Hi.
>
>I'm implementing the start_response callable for Nginx mod_wsgi and I
>have a few questions.
>
>1) From the WSGI PEP it seems that an implementation is allowed to
> *always* raise an exception when start_response is called with a not
> null exc_info.
>
> Is this true?
Yes - as long as it's the exc_info passed in, i.e.:
try:
raise exc_info[0], exc_info[1], exc_info[2]
finally:
del exc_info
(this pattern of raising prevents the possibility of a reference
cycle passing through the current stack location, keeping lots of
objects around longer than necessary)
>2) What happens if an application call start_response with an incorrect
> status line or headers?
>
> Should an implementation consider the function "called", so that an
> application can call it a second time, *without* the exc_info
> parameter?
Interesting point. I think it would be compliant either way, though.
(I'm skipping your third question because it doesn't matter how many
frameworks use exc_info; if you're implementing WSGI 1.0 you have to
support it.)
More information about the Web-SIG
mailing list