classification
Title: webbrowser regression: BROWSER env var not respected
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.8, Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: miss-islington, serhiy.storchaka, zmwangx
Priority: normal Keywords: patch

Created on 2018-11-24 15:26 by zmwangx, last changed 2018-11-26 23:07 by serhiy.storchaka. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 10693 merged zmwangx, 2018-11-24 15:36
PR 10729 merged miss-islington, 2018-11-26 21:29
Messages (3)
msg330377 - (view) Author: Zhiming Wang (zmwangx) * Date: 2018-11-24 15:26
This is a regression in Python 3.7:

    $ BROWSER=w3m python3.6 -c 'import sys; import webbrowser; print(sys.version); print(webbrowser.get()); print(webbrowser._tryorder)'
    3.6.7 (default, Nov 24 2018, 09:47:01)
    [GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)]
    <webbrowser.GenericBrowser object at 0x1066207f0>
    ['w3m', 'MacOSX', 'chrome', 'firefox', 'safari', 'w3m']

    $ BROWSER=w3m python3.7 -c 'import sys; import webbrowser; print(sys.version); print(webbrowser.get()); print(webbrowser._tryorder)'
    3.7.1 (default, Nov 24 2018, 09:35:18)
    [Clang 10.0.0 (clang-1000.11.45.5)]
    <webbrowser.MacOSXOSAScript object at 0x1061fe828>
    ['MacOSX', 'chrome', 'firefox', 'safari', 'w3m', 'w3m']

Note how Python 3.7.1 webbrowser decides to choose MacOSX as the default although BROWSER is explicitly set to w3m. (The above code does not run on Python 3.7.0 due to bpo-31014).

This is because of misinterpretation of the `preferred` kwarg when bpo-31014 was fixed. See https://github.com/python/cpython/commit/25b804a9c21c735ce322877f105ebab2539ccfc1#diff-546766353a40839aa72374ecca5b0925R566. Browsers in BROWSER should be registered as `preferred=True` instead.
msg330465 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-11-26 21:29
New changeset 8c281ed403fd915284d5bba2405d7c47f8195066 by Serhiy Storchaka (Zhiming Wang) in branch 'master':
bpo-35308: Fix regression where BROWSER env var is not respected. (GH-10693)
https://github.com/python/cpython/commit/8c281ed403fd915284d5bba2405d7c47f8195066
msg330468 - (view) Author: miss-islington (miss-islington) Date: 2018-11-26 21:49
New changeset 2a37f013ec81099a6156160ce66803b2609bb7f4 by Miss Islington (bot) in branch '3.7':
bpo-35308: Fix regression where BROWSER env var is not respected. (GH-10693)
https://github.com/python/cpython/commit/2a37f013ec81099a6156160ce66803b2609bb7f4
History
Date User Action Args
2018-11-26 23:07:19serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-11-26 21:49:33miss-islingtonsetnosy: + miss-islington
messages: + msg330468
2018-11-26 21:29:57miss-islingtonsetpull_requests: + pull_request9977
2018-11-26 21:29:49serhiy.storchakasetmessages: + msg330465
2018-11-24 15:36:53zmwangxsetkeywords: + patch
stage: patch review
pull_requests: + pull_request9946
2018-11-24 15:29:58zmwangxsetnosy: + serhiy.storchaka
2018-11-24 15:26:41zmwangxcreate