cpython: 901c790e4417 (original) (raw)
Mercurial > cpython
changeset 78846:901c790e4417
#15447: Use subprocess.DEVNULL in webbrowser, instead of opening This eliminates a ResourceWarning, since before webbrowser was explicitly opening os.devnull and then leaving it open. Tests to follow. Patch by Anton Barkovsky. [#15447]
R David Murray rdmurray@bitdance.com | |
---|---|
date | Mon, 03 Sep 2012 12:44:29 -0400 |
parents | 323ca2f0e382 |
children | 5da3b2df38b3 |
files | Lib/webbrowser.py Misc/NEWS |
diffstat | 2 files changed, 5 insertions(+), 2 deletions(-)[+] [-] Lib/webbrowser.py 4 Misc/NEWS 3 |
line wrap: on
line diff
--- a/Lib/webbrowser.py +++ b/Lib/webbrowser.py @@ -230,7 +230,7 @@ class UnixBrowser(BaseBrowser): cmdline = [self.name] + raise_opt + args if remote or self.background:
inout = io.open(os.devnull, "r+")[](#l1.7)
inout = subprocess.DEVNULL[](#l1.8) else:[](#l1.9) # for TTY browsers, we need stdin/out[](#l1.10) inout = None[](#l1.11)
@@ -354,7 +354,7 @@ class Konqueror(BaseBrowser): else: action = "openURL"
devnull = io.open(os.devnull, "r+")[](#l1.16)
devnull = subprocess.DEVNULL[](#l1.17) # if possible, put browser in separate process group, so[](#l1.18) # keyboard interrupts don't affect browser as well as Python[](#l1.19) setsid = getattr(os, 'setsid', None)[](#l1.20)
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -21,6 +21,9 @@ Core and Builtins Library ------- +- Issue #15447: Use subprocess.DEVNULL in webbrowser, instead of opening