[issue21497] faulthandler should handle sys.stderr being None gracefully

2014-05-14 Thread Roundup Robot
Roundup Robot added the comment: New changeset ddd7db7cf036 by Victor Stinner in branch '3.4': Issue #21497: faulthandler functions now raise a better error if sys.stderr is http://hg.python.org/cpython/rev/ddd7db7cf036 New changeset cb26887f9140 by Victor Stinner in branch 'default': (Merge

[issue21497] faulthandler should handle sys.stderr being None gracefully

2014-05-14 Thread STINNER Victor
STINNER Victor added the comment: I applied my patch, thanks for the report. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21497 ___

[issue21497] faulthandler should handle sys.stderr being None gracefully

2014-05-13 Thread Florian Bruhin
New submission from Florian Bruhin: When faulthandler is used while sys.stderr is None (e.g. when using pythonw.exe), a (IMHO) confusing exception is raised: Traceback (most recent call last): File test.py, line 7, in module faulthandler.enable() AttributeError:

[issue21497] faulthandler should handle sys.stderr being None gracefully

2014-05-13 Thread STINNER Victor
STINNER Victor added the comment: Attached patch modifies faulthandler to raises a RuntimeError(sys.stderr is None) with your use case. Is it what you expected? -- keywords: +patch Added file: http://bugs.python.org/file35243/faulthandler.patch ___

[issue21497] faulthandler should handle sys.stderr being None gracefully

2014-05-13 Thread Florian Bruhin
Florian Bruhin added the comment: I didn't test the patch (I don't have the toolchain set up to do so), but it looks like this is indeed an exception which makes more sense to the developer. When I saw the exception as it is now, I only discovered it's related to stderr being None by finding

[issue21497] faulthandler should handle sys.stderr being None gracefully

2014-05-13 Thread STINNER Victor
STINNER Victor added the comment: I personally would prefer failing silently though so the application still runs (if there's no stderr, there just is no fault log), but that's debatable of course. Nope, there is no debate: there is the Zen of Python :-) Errors should never pass silently.

[issue21497] faulthandler should handle sys.stderr being None gracefully

2014-05-13 Thread Florian Bruhin
Florian Bruhin added the comment: The thing is the developer is not necessarely the one controlling if sys.stderr is None, sometimes the user is. For example, see https://docs.python.org/3.4/using/windows.html#executing-scripts-without-the-python-launcher - an user might have decided to use

[issue21497] faulthandler should handle sys.stderr being None gracefully

2014-05-13 Thread STINNER Victor
STINNER Victor added the comment: This means there's an unexpected gotcha I prefer to see an exception before sys.stderr is None, instead of not seeing the traceback when the application does crash. It is usually a pain to reproduce a crash in the exact same conditions. if I want my