Skip to content

Commit dd5f43a

Browse files
bpo-34019: Fix wrong arguments for Opera Browser (GH-8047)
The Opera Browser was using a outdated command line invocation that resulted in an incorrect URL being opened in the browser when requested using the webbrowser module. * Correct the arguments passed to the Opera Browser when opening a new URL. (cherry picked from commit 3cf1f15) Co-authored-by: Bumsik Kim <[email protected]>
1 parent 3bd9d3b commit dd5f43a

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

Lib/test/test_webbrowser.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,23 +170,23 @@ class OperaCommandTest(CommandTestMixin, unittest.TestCase):
170170

171171
def test_open(self):
172172
self._test('open',
173-
options=['-remote'],
174-
arguments=['openURL({})'.format(URL)])
173+
options=[],
174+
arguments=[URL])
175175

176176
def test_open_with_autoraise_false(self):
177177
self._test('open', kw=dict(autoraise=False),
178-
options=['-remote', '-noraise'],
179-
arguments=['openURL({})'.format(URL)])
178+
options=[],
179+
arguments=[URL])
180180

181181
def test_open_new(self):
182182
self._test('open_new',
183-
options=['-remote'],
184-
arguments=['openURL({},new-window)'.format(URL)])
183+
options=['--new-window'],
184+
arguments=[URL])
185185

186186
def test_open_new_tab(self):
187187
self._test('open_new_tab',
188-
options=['-remote'],
189-
arguments=['openURL({},new-page)'.format(URL)])
188+
options=[],
189+
arguments=[URL])
190190

191191

192192
class ELinksCommandTest(CommandTestMixin, unittest.TestCase):

Lib/webbrowser.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,11 +290,10 @@ class Chrome(UnixBrowser):
290290
class Opera(UnixBrowser):
291291
"Launcher class for Opera browser."
292292

293-
raise_opts = ["-noraise", ""]
294-
remote_args = ['-remote', 'openURL(%s%action)']
293+
remote_args = ['%action', '%s']
295294
remote_action = ""
296-
remote_action_newwin = ",new-window"
297-
remote_action_newtab = ",new-page"
295+
remote_action_newwin = "--new-window"
296+
remote_action_newtab = ""
298297
background = True
299298

300299

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
webbrowser: Correct the arguments passed to Opera Browser when opening a new URL
2+
using the ``webbrowser`` module. Patch by Bumsik Kim.

0 commit comments

Comments
 (0)