summaryrefslogtreecommitdiffstats
path: root/Lib/webbrowser.py
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2012-09-03 16:44:29 (GMT)
committerR David Murray <rdmurray@bitdance.com>2012-09-03 16:44:29 (GMT)
commit02ca144b92eef8d2b8da10c7b70b4e9d42480b9b (patch)
tree063f5af15f17e058cc53f41492753a491d00d166 /Lib/webbrowser.py
parentd674a770e9880f8587129e18bf7faa049c56c571 (diff)
downloadcpython-02ca144b92eef8d2b8da10c7b70b4e9d42480b9b.zip
cpython-02ca144b92eef8d2b8da10c7b70b4e9d42480b9b.tar.gz
cpython-02ca144b92eef8d2b8da10c7b70b4e9d42480b9b.tar.bz2
#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.
Diffstat (limited to 'Lib/webbrowser.py')
-rw-r--r--Lib/webbrowser.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py
index 8617425..94d4ad4 100644
--- 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+")
+ inout = subprocess.DEVNULL
else:
# for TTY browsers, we need stdin/out
inout = None
@@ -354,7 +354,7 @@ class Konqueror(BaseBrowser):
else:
action = "openURL"
- devnull = io.open(os.devnull, "r+")
+ devnull = subprocess.DEVNULL
# if possible, put browser in separate process group, so
# keyboard interrupts don't affect browser as well as Python
setsid = getattr(os, 'setsid', None)