[Python-checkins] cpython (merge default -> default): merge heads

benjamin.peterson python-checkins at python.org
Wed Aug 1 06:50:19 CEST 2012


http://hg.python.org/cpython/rev/c58f65e22fe9
changeset:   78364:c58f65e22fe9
parent:      78363:cbfb915424fd
parent:      78362:a16403affccd
user:        Benjamin Peterson <benjamin at python.org>
date:        Tue Jul 31 21:50:11 2012 -0700
summary:
  merge heads

files:
  Lib/webbrowser.py |  17 +++++++----------
  Misc/NEWS         |   3 +++
  2 files changed, 10 insertions(+), 10 deletions(-)


diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py
--- a/Lib/webbrowser.py
+++ b/Lib/webbrowser.py
@@ -232,17 +232,14 @@
                              stdout=(self.redirect_stdout and inout or None),
                              stderr=inout, start_new_session=True)
         if remote:
-            # wait five seconds. If the subprocess is not finished, the
+            # wait at most five seconds. If the subprocess is not finished, the
             # remote invocation has (hopefully) started a new instance.
-            time.sleep(1)
-            rc = p.poll()
-            if rc is None:
-                time.sleep(4)
-                rc = p.poll()
-                if rc is None:
-                    return True
-            # if remote call failed, open() will try direct invocation
-            return not rc
+            try:
+                rc = p.wait(5)
+                # if remote call failed, open() will try direct invocation
+                return not rc
+            except subprocess.TimeoutExpired:
+                return True
         elif self.background:
             if p.poll() is None:
                 return True
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -72,6 +72,9 @@
 Library
 -------
 
+- Issue #15499: Launching a webbrowser in Unix used to sleep for a few
+  seconds.  Original patch by Anton Barkovsky.
+  
 - Issue #15463: the faulthandler module truncates strings to 500 characters,
   instead of 100, to be able to display long file paths
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list