Message248579
@zzeeek
For Python 3 pipeline tools you need something like this:
try:
<all your stuff>
finally:
try:
sys.stdout.flush()
finally:
try:
sys.stdout.close()
finally:
try:
sys.stderr.flush()
finally:
sys.stderr.close()
This will:
- capture any exceptions *you've* raised as the context for the errors raised in this handler
- expose any exceptions generated during this thing itself
- prevent the interpreter dying during shutdown in flush_std_files by closing the files (you can't easily wipe out the pending writes that have failed)
You could alternatively reopen stdout and stderr on the same fds, giving you new buffers with no pending writes. Anyhow - the key thing is:
- ensure that at shutdown, there are no pending writes for the interpreter lifecycle to flush, and you won't hit this bug. |
|
Date |
User |
Action |
Args |
2015-08-14 10:46:31 | rbcollins | set | recipients:
+ rbcollins, terry.reedy, ncoghlan, pitrou, zzzeek, flox, ulidtko, Jeremy.Fishman, daumiller, Christopher.Heiny |
2015-08-14 10:46:31 | rbcollins | set | messageid: <1439549191.91.0.339917662802.issue11380@psf.upfronthosting.co.za> |
2015-08-14 10:46:31 | rbcollins | link | issue11380 messages |
2015-08-14 10:46:31 | rbcollins | create | |
|