Skip to content

Commit dc06b3d

Browse files
miss-islingtonakx
andauthored
[3.13] gh-123494: Improve documentation for webbrowser return types (GH-123495) (#123548)
gh-123494: Improve documentation for ``webbrowser`` return types (GH-123495) Document the return value for ``webbrowser.open*()``. (cherry picked from commit 0b6acfe) Co-authored-by: Aarni Koskela <[email protected]>
1 parent 59a6d48 commit dc06b3d

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Doc/library/webbrowser.rst

+7
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ The following functions are defined:
7272
(note that under many window managers this will occur regardless of the
7373
setting of this variable).
7474

75+
Returns ``True`` if a browser was successfully launched, ``False`` otherwise.
76+
7577
Note that on some platforms, trying to open a filename using this function,
7678
may work and start the operating system's associated program. However, this
7779
is neither supported nor portable.
@@ -84,11 +86,16 @@ The following functions are defined:
8486
Open *url* in a new window of the default browser, if possible, otherwise, open
8587
*url* in the only browser window.
8688

89+
Returns ``True`` if a browser was successfully launched, ``False`` otherwise.
90+
91+
8792
.. function:: open_new_tab(url)
8893

8994
Open *url* in a new page ("tab") of the default browser, if possible, otherwise
9095
equivalent to :func:`open_new`.
9196

97+
Returns ``True`` if a browser was successfully launched, ``False`` otherwise.
98+
9299

93100
.. function:: get(using=None)
94101

Lib/webbrowser.py

+3
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ def open(url, new=0, autoraise=True):
8181
- 1: a new browser window.
8282
- 2: a new browser page ("tab").
8383
If possible, autoraise raises the window (the default) or not.
84+
85+
If opening the browser succeeds, return True.
86+
If there is a problem, return False.
8487
"""
8588
if _tryorder is None:
8689
with _lock:

0 commit comments

Comments
 (0)