diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2014-12-10 22:59:55 +0200 |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-12-10 22:59:55 +0200 |
| commit | 60599525c509a962e8fb5897240d42a56c092961 (patch) | |
| tree | 6c28cb4857666bc60f52624015ae3d879e65751e /Lib/warnings.py | |
| parent | 82c05a54a2ad92cd1d7bb391a62dec0d06bbc13a (diff) | |
| download | cpython-git-60599525c509a962e8fb5897240d42a56c092961.tar.gz | |
Issue #23016: A warning no longer produces AttributeError when the program
is run with pythonw.exe.
Diffstat (limited to 'Lib/warnings.py')
| -rw-r--r-- | Lib/warnings.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/warnings.py b/Lib/warnings.py index 5d5c9a9dcb..3a8fc5db65 100644 --- a/Lib/warnings.py +++ b/Lib/warnings.py @@ -11,6 +11,9 @@ 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 + if file is None: + # sys.stderr is None when ran with pythonw.exe - warnings get lost + return try: file.write(formatwarning(message, category, filename, lineno, line)) except OSError: |
