mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #23016: A warning no longer produces an AttributeError when the program
is run with pythonw.exe.
This commit is contained in:
commit
927131e050
3 changed files with 15 additions and 0 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue