Skip to content

Commit f874d67

Browse files
committed
gh-137586: Address hugovk post-approval concerns
Move webbrowser entry in Doc/deprecations/pending-removal-in-3.17.rst to after typing, to maintain alphabetical order. Move import plistlib to after import threading, per isort/Ruff style of placing stdlib imports after the main import block. Fix :class:`!MacOSX` -> :class:`!MacOS` in the Library NEWS entry. Remove extra blank line in MacOSXOSAScriptTest.mock_popen. Add webbrowser entries to Doc/whatsnew/3.15.rst: one under "Improved modules" describing the new MacOS class, and one under "New deprecations" for MacOSXOSAScript scheduled removal in 3.17.
1 parent 6ddf67f commit f874d67

3 files changed

Lines changed: 20 additions & 2 deletions

File tree

Doc/whatsnew/3.15.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,6 +1390,19 @@ wave
13901390
(Contributed by Lionel Koenig and Michiel W. Beijen in :gh:`60729`.)
13911391

13921392

1393+
webbrowser
1394+
----------
1395+
1396+
* On macOS, the new :class:`~webbrowser.MacOS` class opens URLs via
1397+
:program:`/usr/bin/open` instead of constructing and executing AppleScript
1398+
via :program:`osascript`. The default browser is detected from the
1399+
LaunchServices preferences file using :mod:`plistlib`, with
1400+
:class:`!com.apple.Safari` as the fallback on fresh installations.
1401+
For non-HTTP(S) URLs, :program:`open -b <bundle-id>` is used to route the
1402+
URL through a browser rather than the OS file handler, preventing
1403+
file injection attacks.
1404+
(Contributed by Jeff Lyon in :gh:`137586`.)
1405+
13931406
xml.parsers.expat
13941407
-----------------
13951408

@@ -1780,6 +1793,12 @@ New deprecations
17801793
merely imported or accessed from the :mod:`!typing` module.
17811794

17821795

1796+
* :mod:`webbrowser`:
1797+
1798+
* :class:`~webbrowser.MacOSXOSAScript` is deprecated in favour of
1799+
:class:`~webbrowser.MacOS` and scheduled for removal in Python 3.17.
1800+
(Contributed by Jeff Lyon in :gh:`137586`.)
1801+
17831802
* ``__version__``
17841803

17851804
* The ``__version__``, ``version`` and ``VERSION`` attributes have been

Lib/test/test_webbrowser.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,6 @@ def mock_popen(self, cmd, mode):
431431
self.popen_pipe = MockPopenPipe(cmd, mode)
432432
return self.popen_pipe
433433

434-
435434
def test_default_open(self):
436435
url = "https://python.org"
437436
self.browser.open(url)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Add :class:`!MacOSX` to :mod:`webbrowser` for macOS, which opens URLs via
1+
Add :class:`!MacOS` to :mod:`webbrowser` for macOS, which opens URLs via
22
``/usr/bin/open`` instead of piping AppleScript to ``osascript``.
33
Deprecate :class:`!MacOSXOSAScript` in favour of :class:`!MacOS`.

0 commit comments

Comments
 (0)