Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bpo-40561: Provide docstrings for public-facing webbrowser functions #19999

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 4 commits into from
May 11, 2020
Merged
Changes from 1 commit
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
Next Next commit
Provide docstrings for public-facing webbrowser functions
  • Loading branch information
brsolomon-deloitte committed May 8, 2020
commit 98824034590d92dbaf2152f4db6416c69547c17d
17 changes: 17 additions & 0 deletions 17 Lib/webbrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ def get(using=None):
# instead of "from webbrowser import *".

def open(url, new=0, autoraise=True):
"""Display url using the default browser.

If new is:
- 0: url is opened in the same browser window, if possible
- 1: a new browser window is opened, if possible
- 2: a new browser page ("tab") is opened, if possible

If autoraise is True, the window is raised, if possible.
"""
if _tryorder is None:
with _lock:
if _tryorder is None:
Expand All @@ -80,9 +89,17 @@ def open(url, new=0, autoraise=True):
return False

def open_new(url):
"""Open url in a new window of the default browser.

If not possible, then open url in the only browser window.
"""
return open(url, 1)

def open_new_tab(url):
"""Open url in a new page ("tab") of the default browser.

If not possible, then the behavior becomes equivalent to open_new().
"""
return open(url, 2)


Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.