Redirecting stderr for extension modules
Michael Pyle
mpyle at legato.com
Thu May 15 12:55:16 EDT 2003
Hi Jeff,
Yep, we worked this one out after I sent the email and on Solaris everything
works a lot better. On Windows, however, nothing ever actually makes it into
the redirection file.
Just to reiterate a little, so the body of a finally is the absolute last
thing that is executed? Even after the return values are constructed in the
return statement?
Thanks.
--Mike
-----Original Message-----
From: Jeff Epler [mailto:jepler at unpythonic.net]
Sent: Thursday, May 15, 2003 9:49 AM
To: Michael Pyle
Cc: 'python-list at python.org'
Subject: Re: Redirecting stderr for extension modules
Michael,
I think that what happens is that the return value (a tuple) is constructed
in the line
return result, stderr
and then the body of the 'finally' is executed, setting stderr to a
different value.
You can write it this way (with the repeated 'if file: ...' block)
try:
result = fn( *args, *kwds)
except:
if file: ...
raise
else:
if file: ...
return result, stderr
Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20030515/0c8d0190/attachment.html>
More information about the Python-list
mailing list