Message232342
| Author |
stockbsd |
| Recipients |
stockbsd |
| Date |
2014年12月09日.01:27:02 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1418088423.32.0.545997731561.issue23016@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
in py3k, the following simple code will throw an uncatched exception when executed with pythonw:
import warnings
warnings.warn('test')
the problem occurs in showarning function: in py3k's pythonw , stderr/stdout is set to None, so the file.write(...) statement will thorw AttributeError uncatched. I think a catch-all except(delete 'OSError') can solve this.
def showwarning(message, category, filename, lineno, file=None, line=None):
"""Hook to write a warning to a file; replace if you like."""
if file is None:
file = sys.stderr
try:
file.write(formatwarning(message, category, filename, lineno, line))
except OSError:
pass # the file (probably stderr) is invalid - this warning gets lost. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2014年12月09日 01:27:03 | stockbsd | set | recipients:
+ stockbsd |
| 2014年12月09日 01:27:03 | stockbsd | set | messageid: <1418088423.32.0.545997731561.issue23016@psf.upfronthosting.co.za> |
| 2014年12月09日 01:27:03 | stockbsd | link | issue23016 messages |
| 2014年12月09日 01:27:02 | stockbsd | create |
|