https://github.com/python/cpython/commit/c41c7876868b973e6e3b65139305957d7f8e85b1 commit: c41c7876868b973e6e3b65139305957d7f8e85b1 branch: 3.12 author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com> committer: AA-Turner <9087854+aa-tur...@users.noreply.github.com> date: 2024-09-01T05:36:18Z summary:
[3.12] gh-123494: Improve documentation for ``webbrowser`` return types (GH-123495) (#123549) gh-123494: Improve documentation for ``webbrowser`` return types (GH-123495) Document the return value for ``webbrowser.open*()``. (cherry picked from commit 0b6acfee04b30e7993314723c614625ddd90ae6e) Co-authored-by: Aarni Koskela <a...@iki.fi> files: M Doc/library/webbrowser.rst M Lib/webbrowser.py diff --git a/Doc/library/webbrowser.rst b/Doc/library/webbrowser.rst index df22c5f5e1ecf4..c34b2170f8f1e3 100644 --- a/Doc/library/webbrowser.rst +++ b/Doc/library/webbrowser.rst @@ -62,6 +62,8 @@ The following functions are defined: (note that under many window managers this will occur regardless of the setting of this variable). + Returns ``True`` if a browser was successfully launched, ``False`` otherwise. + Note that on some platforms, trying to open a filename using this function, may work and start the operating system's associated program. However, this is neither supported nor portable. @@ -74,11 +76,16 @@ The following functions are defined: Open *url* in a new window of the default browser, if possible, otherwise, open *url* in the only browser window. + Returns ``True`` if a browser was successfully launched, ``False`` otherwise. + + .. function:: open_new_tab(url) Open *url* in a new page ("tab") of the default browser, if possible, otherwise equivalent to :func:`open_new`. + Returns ``True`` if a browser was successfully launched, ``False`` otherwise. + .. function:: get(using=None) diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py index e9cc71fa331e2d..13b9e85f9e15e3 100755 --- a/Lib/webbrowser.py +++ b/Lib/webbrowser.py @@ -77,6 +77,9 @@ def open(url, new=0, autoraise=True): - 1: a new browser window. - 2: a new browser page ("tab"). If possible, autoraise raises the window (the default) or not. + + If opening the browser succeeds, return True. + If there is a problem, return False. """ if _tryorder is None: with _lock: _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com