[issue5319] stdout error at interpreter shutdown fails to return OS error status

Antoine Pitrou report at bugs.python.org
Sun Aug 8 23:40:37 CEST 2010


Antoine Pitrou <pitrou at free.fr> added the comment:

I've committed the py3k fix in r83854 (3.1 in r83855).
As for 2.6/2.7, I've finally diagnosed the problem: 2.6 and upwards use PyErr_Print() in the file destructor, but the sys.stderr and sys.excepthook objects are already None at that time (because of interpreter shutdown). Therefore the error can't be printed out.
2.5 and earlier used a direct fprintf() of the errno code to stderr.

I propose to ignore the 2.6/2.7 issue of the error not being printed properly, since it only happens at shutdown with a misbehaving stdout, which is not very common.

As for the issue of the stdout error not being reported in the process return code, this would be possible in 3.x, although it would involve changing the signature of Py_Finalize() to include a return status (it currently returns void).

----------
title: I/O error during one-liner fails to return OS error status -> stdout error at interpreter shutdown fails to return OS error status
versions:  -Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5319>
_______________________________________


More information about the Python-bugs-list mailing list