Redirecting stderr for extension modules
Jeff Epler
jepler at unpythonic.net
Thu May 15 12:48:47 EDT 2003
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
More information about the Python-list
mailing list