Author rbcollins
Recipients rbcollins, serhiy.storchaka
Date 2015-08-14.10:38:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1439548688.0.0.846509551874.issue24864@psf.upfronthosting.co.za>
In-reply-to
Content
Oh, one nuance - the reason my except isn't triggering is that the write is happening in interpreter shutdown - in flush_std_files.

Adding a a flush there allows that to work, but its fugly:

---
import sys

try:
    print("What... is your quest?")
    # Workaround bug 24864: force the write to be immediate
    sys.stdout.flush()
except:
    sys.stderr.write("Exception in program.\n")
    e = sys.exc_info()[1]
    try:
        # Workaround bug 24864 close the file so flush_std_files doesn't run
        # during interpreter cleanup.
        sys.stdout.close()
    finally:
        raise e from None
        
---
History
Date User Action Args
2015-08-14 10:38:08rbcollinssetrecipients: + rbcollins, serhiy.storchaka
2015-08-14 10:38:08rbcollinssetmessageid: <1439548688.0.0.846509551874.issue24864@psf.upfronthosting.co.za>
2015-08-14 10:38:07rbcollinslinkissue24864 messages
2015-08-14 10:38:07rbcollinscreate