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

Skip to content

Commit c41c787

Browse files
miss-islingtonakx
andauthored
[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 0b6acfe) Co-authored-by: Aarni Koskela <[email protected]>
1 parent 4eaf489 commit c41c787

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Doc/library/webbrowser.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ The following functions are defined:
6262
(note that under many window managers this will occur regardless of the
6363
setting of this variable).
6464

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

79+
Returns ``True`` if a browser was successfully launched, ``False`` otherwise.
80+
81+
7782
.. function:: open_new_tab(url)
7883

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

87+
Returns ``True`` if a browser was successfully launched, ``False`` otherwise.
88+
8289

8390
.. function:: get(using=None)
8491

Lib/webbrowser.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ def open(url, new=0, autoraise=True):
7777
- 1: a new browser window.
7878
- 2: a new browser page ("tab").
7979
If possible, autoraise raises the window (the default) or not.
80+
81+
If opening the browser succeeds, return True.
82+
If there is a problem, return False.
8083
"""
8184
if _tryorder is None:
8285
with _lock:

0 commit comments

Comments
 (0)