From 8f670b57969cec58c1a461fec46bfa1eb6398c07 Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Thu, 19 Aug 2021 23:50:24 +0900 Subject: [PATCH 1/2] bpo-42255: Deprecate webbrowser.MacOSX from Python 3.11 --- Doc/library/webbrowser.rst | 7 +++++-- Doc/whatsnew/3.11.rst | 4 ++++ Lib/webbrowser.py | 3 +++ .../next/Library/2021-08-19-23-49-10.bpo-42255.ofe3ms.rst | 3 +++ 4 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2021-08-19-23-49-10.bpo-42255.ofe3ms.rst diff --git a/Doc/library/webbrowser.rst b/Doc/library/webbrowser.rst index bd0919164d8fa0..a0e0e7f5da56eb 100644 --- a/Doc/library/webbrowser.rst +++ b/Doc/library/webbrowser.rst @@ -143,9 +143,9 @@ for the controller classes, all defined in this module. +------------------------+-----------------------------------------+-------+ | ``'windows-default'`` | :class:`WindowsDefault` | \(2) | +------------------------+-----------------------------------------+-------+ -| ``'macosx'`` | :class:`MacOSX('default')` | \(3) | +| ``'macosx'`` | :class:`MacOSXOSAScript('default')` | \(3) | +------------------------+-----------------------------------------+-------+ -| ``'safari'`` | :class:`MacOSX('safari')` | \(3) | +| ``'safari'`` | :class:`MacOSXOSAScript('safari')` | \(3) | +------------------------+-----------------------------------------+-------+ | ``'google-chrome'`` | :class:`Chrome('google-chrome')` | | +------------------------+-----------------------------------------+-------+ @@ -174,6 +174,9 @@ Notes: .. versionadded:: 3.3 Support for Chrome/Chromium has been added. +.. deprecated-removed:: 3.11 3.12 + :class:`MacOSX` is deprecated, use :class:`MacOSXOSAScript` instead. + Here are some simple examples:: url = 'https://docs.python.org/' diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index d6a95a2e3175c7..8d4721452d0f46 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -292,6 +292,10 @@ Deprecated Python 3.10 or newer. See the :pep:`617` (New PEG parser for CPython). (Contributed by Victor Stinner in :issue:`40360`.) +* :class:`webbrowser.MacOSX` is deprecated and will be removed at Python 3.12. + It is untested and undocumented and also not used by webbrowser itself. + (Contributed by Dong-hee Na in :issue:`42255`.) + Removed ======= diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py index ec3cece48c9587..d8a9915cac5f6f 100755 --- a/Lib/webbrowser.py +++ b/Lib/webbrowser.py @@ -8,6 +8,7 @@ import sys import subprocess import threading +import warnings __all__ = ["Error", "open", "open_new", "open_new_tab", "get", "register"] @@ -629,6 +630,8 @@ class MacOSX(BaseBrowser): Internet System Preferences panel, will be used. """ def __init__(self, name): + warnings.warn(f'{self.__class__.__name__} is deprecated in 3.11' + ' use MacOSXOSAScript instead.', DeprecationWarning, stacklevel=2) self.name = name def open(self, url, new=0, autoraise=True): diff --git a/Misc/NEWS.d/next/Library/2021-08-19-23-49-10.bpo-42255.ofe3ms.rst b/Misc/NEWS.d/next/Library/2021-08-19-23-49-10.bpo-42255.ofe3ms.rst new file mode 100644 index 00000000000000..e62cc5e4d5612c --- /dev/null +++ b/Misc/NEWS.d/next/Library/2021-08-19-23-49-10.bpo-42255.ofe3ms.rst @@ -0,0 +1,3 @@ +:class:`webbrowser.MacOSX` is deprecated and will be removed at Python 3.12. +It is untested and undocumented and also not used by webbrowser itself. +Patch by Dong-hee Na. From 39b243b85ee9c6e137dd05e481af4455c67d0f43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Fri, 3 Sep 2021 17:49:45 +0200 Subject: [PATCH 2/2] s/3.12/3.13/ --- Doc/library/webbrowser.rst | 2 +- Doc/whatsnew/3.11.rst | 2 +- .../next/Library/2021-08-19-23-49-10.bpo-42255.ofe3ms.rst | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/webbrowser.rst b/Doc/library/webbrowser.rst index a0e0e7f5da56eb..27e0b51ccf8965 100644 --- a/Doc/library/webbrowser.rst +++ b/Doc/library/webbrowser.rst @@ -174,7 +174,7 @@ Notes: .. versionadded:: 3.3 Support for Chrome/Chromium has been added. -.. deprecated-removed:: 3.11 3.12 +.. deprecated-removed:: 3.11 3.13 :class:`MacOSX` is deprecated, use :class:`MacOSXOSAScript` instead. Here are some simple examples:: diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index 8d4721452d0f46..896a292c3356e8 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -292,7 +292,7 @@ Deprecated Python 3.10 or newer. See the :pep:`617` (New PEG parser for CPython). (Contributed by Victor Stinner in :issue:`40360`.) -* :class:`webbrowser.MacOSX` is deprecated and will be removed at Python 3.12. +* :class:`webbrowser.MacOSX` is deprecated and will be removed in Python 3.13. It is untested and undocumented and also not used by webbrowser itself. (Contributed by Dong-hee Na in :issue:`42255`.) diff --git a/Misc/NEWS.d/next/Library/2021-08-19-23-49-10.bpo-42255.ofe3ms.rst b/Misc/NEWS.d/next/Library/2021-08-19-23-49-10.bpo-42255.ofe3ms.rst index e62cc5e4d5612c..84a02c4c3fb2b4 100644 --- a/Misc/NEWS.d/next/Library/2021-08-19-23-49-10.bpo-42255.ofe3ms.rst +++ b/Misc/NEWS.d/next/Library/2021-08-19-23-49-10.bpo-42255.ofe3ms.rst @@ -1,3 +1,3 @@ -:class:`webbrowser.MacOSX` is deprecated and will be removed at Python 3.12. +:class:`webbrowser.MacOSX` is deprecated and will be removed in Python 3.13. It is untested and undocumented and also not used by webbrowser itself. Patch by Dong-hee Na.