Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8f670b5

Browse files
committed
bpo-42255: Deprecate webbrowser.MacOSX from Python 3.11
1 parent be9de87 commit 8f670b5

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

Doc/library/webbrowser.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ for the controller classes, all defined in this module.
143143
+------------------------+-----------------------------------------+-------+
144144
| ``'windows-default'`` | :class:`WindowsDefault` | \(2) |
145145
+------------------------+-----------------------------------------+-------+
146-
| ``'macosx'`` | :class:`MacOSX('default')` | \(3) |
146+
| ``'macosx'`` | :class:`MacOSXOSAScript('default')` | \(3) |
147147
+------------------------+-----------------------------------------+-------+
148-
| ``'safari'`` | :class:`MacOSX('safari')` | \(3) |
148+
| ``'safari'`` | :class:`MacOSXOSAScript('safari')` | \(3) |
149149
+------------------------+-----------------------------------------+-------+
150150
| ``'google-chrome'`` | :class:`Chrome('google-chrome')` | |
151151
+------------------------+-----------------------------------------+-------+
@@ -174,6 +174,9 @@ Notes:
174174
.. versionadded:: 3.3
175175
Support for Chrome/Chromium has been added.
176176

177+
.. deprecated-removed:: 3.11 3.12
178+
:class:`MacOSX` is deprecated, use :class:`MacOSXOSAScript` instead.
179+
177180
Here are some simple examples::
178181

179182
url = 'https://docs.python.org/'

Doc/whatsnew/3.11.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,10 @@ Deprecated
292292
Python 3.10 or newer. See the :pep:`617` (New PEG parser for CPython).
293293
(Contributed by Victor Stinner in :issue:`40360`.)
294294

295+
* :class:`webbrowser.MacOSX` is deprecated and will be removed at Python 3.12.
296+
It is untested and undocumented and also not used by webbrowser itself.
297+
(Contributed by Dong-hee Na in :issue:`42255`.)
298+
295299

296300
Removed
297301
=======

Lib/webbrowser.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import sys
99
import subprocess
1010
import threading
11+
import warnings
1112

1213
__all__ = ["Error", "open", "open_new", "open_new_tab", "get", "register"]
1314

@@ -629,6 +630,8 @@ class MacOSX(BaseBrowser):
629630
Internet System Preferences panel, will be used.
630631
"""
631632
def __init__(self, name):
633+
warnings.warn(f'{self.__class__.__name__} is deprecated in 3.11'
634+
' use MacOSXOSAScript instead.', DeprecationWarning, stacklevel=2)
632635
self.name = name
633636

634637
def open(self, url, new=0, autoraise=True):
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:class:`webbrowser.MacOSX` is deprecated and will be removed at Python 3.12.
2+
It is untested and undocumented and also not used by webbrowser itself.
3+
Patch by Dong-hee Na.

0 commit comments

Comments
 (0)