diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-06-25 00:17:37 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-06-25 00:17:37 +0200 |
commit | b28a375f2f4724c129e8683f548c8f1477e00a68 (patch) | |
tree | 2db689a322b090dcc348863f2e632d1dfdcf86e7 /Lib/idlelib/PyShell.py | |
parent | 7660b880a583442af8ad9d5c91ce608abd4b9654 (diff) | |
download | cpython-git-b28a375f2f4724c129e8683f548c8f1477e00a68.tar.gz |
Issue #18081: Workaround "./python -m test_idle test_logging" failure
"import idlelib" should not install hooks on the warning modules, hooks should
only be installed when IDLE is started.
Diffstat (limited to 'Lib/idlelib/PyShell.py')
-rw-r--r-- | Lib/idlelib/PyShell.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py index d8a5cd2433..cde389ad00 100644 --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -61,7 +61,6 @@ else: lineno, line=line)) except OSError: pass ## file (probably __stderr__) is invalid, warning dropped. - warnings.showwarning = idle_showwarning def idle_formatwarning(message, category, filename, lineno, line=None): """Format warnings the IDLE way""" s = "\nWarning (from warnings module):\n" @@ -73,7 +72,6 @@ else: s += " %s\n" % line s += "%s: %s\n>>> " % (category.__name__, message) return s - warnings.formatwarning = idle_formatwarning def extended_linecache_checkcache(filename=None, orig_checkcache=linecache.checkcache): @@ -1425,6 +1423,9 @@ echo "import sys; print(sys.argv)" | idle - "foobar" def main(): global flist, root, use_subprocess + warnings.showwarning = idle_showwarning + warnings.formatwarning = idle_formatwarning + use_subprocess = True enable_shell = False enable_edit = False |