[Python-checkins] cpython (merge 3.2 -> default): Merge #15509: If %action substitution produces a null string, drop it.
r.david.murray
python-checkins at python.org
Mon Sep 3 18:53:29 CEST 2012
http://hg.python.org/cpython/rev/323ca2f0e382
changeset: 78845:323ca2f0e382
parent: 78843:c9c9d890400c
parent: 78844:6768aa70c2d3
user: R David Murray <rdmurray at bitdance.com>
date: Mon Sep 03 12:37:59 2012 -0400
summary:
Merge #15509: If %action substitution produces a null string, drop it.
Patch by Anton Barkovsky, comment addition by me.
This shows up as a bug in 3.3 because the definition for Chrome
produces such an empty string. Tests will follow.
files:
Lib/webbrowser.py | 11 +++++++++--
Misc/NEWS | 3 +++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py
--- a/Lib/webbrowser.py
+++ b/Lib/webbrowser.py
@@ -206,12 +206,18 @@
"""Parent class for all Unix browsers with remote functionality."""
raise_opts = None
+ background = False
+ redirect_stdout = True
+ # In remote_args, %s will be replaced with the requested URL. %action will
+ # be replaced depending on the value of 'new' passed to open.
+ # remote_action is used for new=0 (open). If newwin is not None, it is
+ # used for new=1 (open_new). If newtab is not None, it is used for
+ # new=3 (open_new_tab). After both substitutions are made, any empty
+ # strings in the transformed remote_args list will be removed.
remote_args = ['%action', '%s']
remote_action = None
remote_action_newwin = None
remote_action_newtab = None
- background = False
- redirect_stdout = True
def _invoke(self, args, remote, autoraise):
raise_opt = []
@@ -264,6 +270,7 @@
args = [arg.replace("%s", url).replace("%action", action)
for arg in self.remote_args]
+ args = [arg for arg in args if arg]
success = self._invoke(args, True, autoraise)
if not success:
# remote invocation failed, try straight way
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -21,6 +21,9 @@
Library
-------
+- Issue #15509: webbrowser.UnixBrowser no longer passes empty arguments to
+ Popen when %action substitutions produce empty strings.
+
- Issue #12776,#11839: call argparse type function (specified by add_argument)
only once. Before, the type function was called twice in the case where the
default was specified and the argument was given as well. This was
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list