GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||
GeezerVison is showing github.com — bpo-24241: Preferred X browser by davesteele · Pull Request #85 · python/cpython Conversation
Contributor
When calling webbrowser.open*(), the module goes through a list of installed browsers, and uses the first one that succeeds, to process the request. The first 'browsers' in the 'X' list are 'xdg-open' and others of that ilk. The problem is that they only have one 'open' behavior - the 'new' parameter is ignored ('same window', 'new window', 'new tab'). These commits move the default web browser to the front of the tryorder list, allowing get() behavior to match the documentation. This same problem was recently fixed in Windows via Issue #8232
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Found improvements to the code.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure you should
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure what to report, otherwise. Passing on the FileNotFoundError feels right to me. I could drop catching CalledProcessError?
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could use shutil.which to determine if xdg-settings exists before trying to call it (LBYL). But here ignoring the exception (EAFP) seems right to me.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With a I believe that would be more self-explanatory as to the purpose of ignoring the exceptions here (if we fail to find the xdg default browser, we simply don't add it to the preferred browser set)
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
ultimatecoder
suggested changes
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will suggest updating the documentation for method
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
merwok
reviewed
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if it’s good to change the signature here. Is it impossible to give high priority to the browser found with xdg-settings, if any, with the update_tryorder param?
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I took the opportunity to make what I thought was an improvement. The tri-state definition of the old parameter seemed a bit clumsy and unnecessary (note that it was left out of the documentation). I can back out the change to update_tryorder if it is deemed appropriate.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd suggest making the parameter
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
ncoghlan
requested changes
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like the general idea of this patch, but think it would be more self-explanatory with some changes to the specific implementation details.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rather than only allowing a single preferred browser, perhaps it would make sense to make this a
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My original implementation did this, but I didn't find the enhancement useful. There weren't any ripples. That said, I'll make the change if this is considered a blocker.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With a set, this condition would become
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'preferred' is a better name. I'll make the change.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had managed to make it to this point without encountering the keyword-only concept in the library (or elsewhere, for that matter). Would this cause unnecessary confusion?
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that 'name in _preferred_browsers' is not enough. xdg-settings returns e.g. 'firefox.desktop'.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. keyword-only is our preferred approach to handling boolean arguments in Python 3, as otherwise you end up with code that's ambiguous at the point of calling (as here, where the Regarding
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A slight name tweak may help convey the difference between this field and the new parameter to
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With a I believe that would be more self-explanatory as to the purpose of ignoring the exceptions here (if we fail to find the xdg default browser, we simply don't add it to the preferred browser set)
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd suggest making the parameter
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the above suggested change to the signature of
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll add the 'else' construct.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. Replace the existing undocumented tri-state 'try_order' parameter with the boolean keyword-only 'preferred' parameter. Setting it to True places the browser at the front of the list, preferring it as the return to a subsequent get() call. 'preferred' is added to the documentation. The traditional first entry in the tryorder queue is xdg-open, which doesn't support new window. Make the default browser first in the try list, to properly support these options.
davesteele
force-pushed
the
preferred_browser
branch
from
795ee09 to
871455f
Compare
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
ncoghlan
approved these changes
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
akruis
pushed a commit
to akruis/cpython
that referenced
this pull request
…WatchdogEx Fix issue python#85: don't schedule already scheduled tasklets. Ensure that the internal watchdog list is empty before and after all test cases of class TestNewWatchdog. Fix test case TestNewWatchdog.test_watchdog_priority_{hard|soft}. The timeout value was much to short to build up a list of watchdogs. The new test cases TestNewWatchdog.test_schedule_deeper_{hard|soft} triggers the assertion failure reliably. They are skipped for now. https://bitbucket.org/stackless-dev/stackless/issues/85 (grafted from 2235702eb90cb0709dd40544b3952a956f2032a9 and 3fb55ce5b2d4)
akruis
pushed a commit
to akruis/cpython
that referenced
this pull request
akruis
pushed a commit
to akruis/cpython
that referenced
this pull request
colesbury
referenced
this pull request
in colesbury/nogil
Sometimes we need to acquire locks before the current PyThreadState is set. This moves the waiter data to it's own struct. It's shared between PyThreadStates on the same thread, such as in multi-interpreter settings. Fixes #85
jaraco
pushed a commit
that referenced
this pull request
markshannon
pushed a commit
to faster-cpython/cpython
that referenced
this pull request
Add github workflow to build and publish docker image
This was referenced
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reviewers+1 more reviewerUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabelsProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later. | |||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |