[Python-checkins] gh-102690: Use Edge as fallback in webbrowser instead of IE (#102691)

merwok webhook-mailer at python.org
Wed Mar 15 22:52:31 EDT 2023


https://github.com/python/cpython/commit/1c9f3391b916939e5ad18213e553f8d6bfbec25e
commit: 1c9f3391b916939e5ad18213e553f8d6bfbec25e
branch: main
author: Jamoo721 <81095953+Jamoo721 at users.noreply.github.com>
committer: merwok <merwok at netwok.org>
date: 2023-03-15T22:52:11-04:00
summary:

gh-102690: Use Edge as fallback in webbrowser instead of IE (#102691)

files:
A Misc/NEWS.d/next/Windows/2023-03-14-10-52-43.gh-issue-102690.sbXtqk.rst
M Lib/webbrowser.py

diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py
index 44974d433b46..a56ff33dbbdc 100755
--- a/Lib/webbrowser.py
+++ b/Lib/webbrowser.py
@@ -542,11 +542,15 @@ def register_standard_browsers():
         # First try to use the default Windows browser
         register("windows-default", WindowsDefault)
 
-        # Detect some common Windows browsers, fallback to IE
-        iexplore = os.path.join(os.environ.get("PROGRAMFILES", "C:\\Program Files"),
-                                "Internet Explorer\\IEXPLORE.EXE")
+        # Detect some common Windows browsers, fallback to Microsoft Edge
+        # location in 64-bit Windows
+        edge64 = os.path.join(os.environ.get("PROGRAMFILES(x86)", "C:\\Program Files (x86)"),
+                              "Microsoft\\Edge\\Application\\msedge.exe")
+        # location in 32-bit Windows
+        edge32 = os.path.join(os.environ.get("PROGRAMFILES", "C:\\Program Files"),
+                              "Microsoft\\Edge\\Application\\msedge.exe")
         for browser in ("firefox", "firebird", "seamonkey", "mozilla",
-                        "netscape", "opera", iexplore):
+                        "opera", edge64, edge32):
             if shutil.which(browser):
                 register(browser, None, BackgroundBrowser(browser))
     else:
diff --git a/Misc/NEWS.d/next/Windows/2023-03-14-10-52-43.gh-issue-102690.sbXtqk.rst b/Misc/NEWS.d/next/Windows/2023-03-14-10-52-43.gh-issue-102690.sbXtqk.rst
new file mode 100644
index 000000000000..5669ebbb442c
--- /dev/null
+++ b/Misc/NEWS.d/next/Windows/2023-03-14-10-52-43.gh-issue-102690.sbXtqk.rst
@@ -0,0 +1 @@
+Update :mod:`webbrowser` to fall back to Microsoft Edge instead of Internet Explorer.



More information about the Python-checkins mailing list