]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-123494: Improve documentation for ``webbrowser`` return types (#123495)
authorAarni Koskela <akx@iki.fi>
Sun, 1 Sep 2024 05:17:03 +0000 (08:17 +0300)
committerGitHub <noreply@github.com>
Sun, 1 Sep 2024 05:17:03 +0000 (06:17 +0100)
Document the return value for ``webbrowser.open*()``.

Doc/library/webbrowser.rst
Lib/webbrowser.py

index 334f21f01c14c09b2f9be84a5a76c69f4b19d03a..4a155974dbd2f5ddd8d8e5348a3d6533b7295678 100644 (file)
@@ -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.
@@ -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)
 
index 252ca92337e272696c8d9928ecbbb3521fb09ec4..d2efc72113a9170c5b1a425762c91f95885e24ab 100644 (file)
@@ -80,6 +80,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: