Skip to content

[3.13] gh-123494: Improve documentation for webbrowser return types (GH-123495) #123548

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Doc/library/webbrowser.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,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.
Expand All @@ -84,11 +86,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)

Expand Down
3 changes: 3 additions & 0 deletions Lib/webbrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,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:
Expand Down
Loading