[issue24864] errors writing to stdout are uncatchable and exit with status 0

2015-08-14 Thread Robert Collins
Robert Collins added the comment: 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?") # Workar

[issue24864] errors writing to stdout are uncatchable and exit with status 0

2015-08-14 Thread Robert Collins
Robert Collins added the comment: FWIW Python 2.7.8 behaves the same way (different message, same behaviour). -- ___ Python tracker ___ __

[issue24864] errors writing to stdout are uncatchable and exit with status 0

2015-08-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See also issue11380. -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailin

[issue24864] errors writing to stdout are uncatchable and exit with status 0

2015-08-14 Thread Robert Collins
Robert Collins added the comment: Oh, and for added joy sys.last_value is not set here, so I've yet to manage to poke at what is being executed - clearly pdb is still managing to single-step, ish. -- ___ Python tracker

[issue24864] errors writing to stdout are uncatchable and exit with status 0

2015-08-14 Thread Robert Collins
New submission from Robert Collins: I was trying to demonstrate how testing some code is hard, and I stumbled upon this. The following code should be debuggable when run with a bad stdout - e.g. python foo.py > /dev/full --- import sys import traceback import pdb;pdb.Pdb(stdout=sys.stderr).s