mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
[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 0b6acfee04
)
Co-authored-by: Aarni Koskela <akx@iki.fi>
This commit is contained in:
parent
4eaf4891c1
commit
c41c787686
2 changed files with 10 additions and 0 deletions
|
@ -62,6 +62,8 @@ The following functions are defined:
|
||||||
(note that under many window managers this will occur regardless of the
|
(note that under many window managers this will occur regardless of the
|
||||||
setting of this variable).
|
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,
|
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
|
may work and start the operating system's associated program. However, this
|
||||||
is neither supported nor portable.
|
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
|
Open *url* in a new window of the default browser, if possible, otherwise, open
|
||||||
*url* in the only browser window.
|
*url* in the only browser window.
|
||||||
|
|
||||||
|
Returns ``True`` if a browser was successfully launched, ``False`` otherwise.
|
||||||
|
|
||||||
|
|
||||||
.. function:: open_new_tab(url)
|
.. function:: open_new_tab(url)
|
||||||
|
|
||||||
Open *url* in a new page ("tab") of the default browser, if possible, otherwise
|
Open *url* in a new page ("tab") of the default browser, if possible, otherwise
|
||||||
equivalent to :func:`open_new`.
|
equivalent to :func:`open_new`.
|
||||||
|
|
||||||
|
Returns ``True`` if a browser was successfully launched, ``False`` otherwise.
|
||||||
|
|
||||||
|
|
||||||
.. function:: get(using=None)
|
.. function:: get(using=None)
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,9 @@ def open(url, new=0, autoraise=True):
|
||||||
- 1: a new browser window.
|
- 1: a new browser window.
|
||||||
- 2: a new browser page ("tab").
|
- 2: a new browser page ("tab").
|
||||||
If possible, autoraise raises the window (the default) or not.
|
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:
|
if _tryorder is None:
|
||||||
with _lock:
|
with _lock:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue