Skip to content
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

bpo-27657: Fix urlparse() with numeric paths #661

Merged
merged 2 commits into from
Oct 18, 2019

Conversation

timgraham
Copy link
Contributor

@timgraham timgraham commented Mar 13, 2017

Revert parsing decision from bpo-754016 in favor of the documented
consensus in bpo-16932 of how to treat strings without a // to
designate the netloc.

https://bugs.python.org/issue27657
https://bugs.python.org/issue754016
https://bugs.python.org/issue16932

https://bugs.python.org/issue27657

@mention-bot
Copy link

@timgraham, thanks for your PR! By analyzing the history of the files in this pull request, we identified @orsenthil, @ncoghlan, @Yhg1s, @serhiy-storchaka and @facundobatista to be potential reviewers.

@alex
Copy link
Member

alex commented Mar 18, 2017

(Fixed the conflicts, which was impressively pleasant!)

Revert parsing decision from bpo-754016 in favor of the documented
consensus in bpo-16932 of how to treat strings without a // to
designate the netloc.
Copy link

@auvipy auvipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice clean ups

@orsenthil
Copy link
Member

This needs a core-dev review and approval. Introducing simple parsing changes can sometimes bring surprises, so we have to cognizant of that, and make sure our intended behavior is preserved.

@orsenthil
Copy link
Member

Let's go with this. This simplifies the parsing logic in favor of all valid URLS. As noted in https://bugs.python.org/issue27657, all the previous attempts were to handle special cases and it was not helpful.

@orsenthil orsenthil merged commit 5a88d50 into python:master Oct 18, 2019
@bedevere-bot
Copy link

@orsenthil: Please replace # with GH- in the commit message next time. Thanks!

@miss-islington
Copy link
Contributor

Thanks @timgraham for the PR, and @orsenthil for merging it 🌮🎉.. I'm working now to backport this PR to: 2.7, 3.7, 3.8.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@miss-islington
Copy link
Contributor

I'm having trouble backporting to 3.8. Reason: 'Error 110 while writing to socket. Connection timed out.'. Please retry by removing and re-adding the needs backport to 3.8 label.

@bedevere-bot
Copy link

GH-16837 is a backport of this pull request to the 3.7 branch.

@miss-islington
Copy link
Contributor

Sorry, @timgraham and @orsenthil, I could not cleanly backport this to 2.7 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 5a88d50ff013a64fbdb25b877c87644a9034c969 2.7

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 18, 2019
* bpo-27657: Fix urlparse() with numeric paths

Revert parsing decision from bpo-754016 in favor of the documented
consensus in bpo-16932 of how to treat strings without a // to
designate the netloc.

* bpo-22891: Remove urlsplit() optimization for 'http' prefixed inputs.
(cherry picked from commit 5a88d50)

Co-authored-by: Tim Graham <timograham@gmail.com>
@orsenthil orsenthil added needs backport to 3.8 only security fixes and removed needs backport to 3.8 only security fixes labels Oct 18, 2019
@miss-islington
Copy link
Contributor

Thanks @timgraham for the PR, and @orsenthil for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry @timgraham and @orsenthil, I had trouble checking out the 3.8 backport branch.
Please backport using cherry_picker on command line.
cherry_picker 5a88d50ff013a64fbdb25b877c87644a9034c969 3.8

miss-islington added a commit that referenced this pull request Oct 18, 2019
* bpo-27657: Fix urlparse() with numeric paths

Revert parsing decision from bpo-754016 in favor of the documented
consensus in bpo-16932 of how to treat strings without a // to
designate the netloc.

* bpo-22891: Remove urlsplit() optimization for 'http' prefixed inputs.
(cherry picked from commit 5a88d50)

Co-authored-by: Tim Graham <timograham@gmail.com>
orsenthil pushed a commit that referenced this pull request Oct 18, 2019
* bpo-27657: Fix urlparse() with numeric paths

Revert parsing decision from bpo-754016 in favor of the documented
consensus in bpo-16932 of how to treat strings without a // to
designate the netloc.

* bpo-22891: Remove urlsplit() optimization for 'http' prefixed inputs.
(cherry picked from commit 5a88d50)

Co-authored-by: Tim Graham <timograham@gmail.com>
@bedevere-bot bedevere-bot removed the needs backport to 3.8 only security fixes label Oct 18, 2019
@bedevere-bot
Copy link

GH-16839 is a backport of this pull request to the 3.8 branch.

orsenthil added a commit that referenced this pull request Oct 18, 2019
* bpo-27657: Fix urlparse() with numeric paths

Revert parsing decision from bpo-754016 in favor of the documented
consensus in bpo-16932 of how to treat strings without a // to
designate the netloc.

* bpo-22891: Remove urlsplit() optimization for 'http' prefixed inputs.
(cherry picked from commit 5a88d50)

Co-authored-by: Tim Graham <timograham@gmail.com>
jacobneiltaylor pushed a commit to jacobneiltaylor/cpython that referenced this pull request Dec 5, 2019
* bpo-27657: Fix urlparse() with numeric paths

Revert parsing decision from bpo-754016 in favor of the documented
consensus in bpo-16932 of how to treat strings without a // to
designate the netloc.

* bpo-22891: Remove urlsplit() optimization for 'http' prefixed inputs.
shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Jan 31, 2020
* bpo-27657: Fix urlparse() with numeric paths

Revert parsing decision from bpo-754016 in favor of the documented
consensus in bpo-16932 of how to treat strings without a // to
designate the netloc.

* bpo-22891: Remove urlsplit() optimization for 'http' prefixed inputs.
orsenthil added a commit that referenced this pull request Feb 16, 2020
orsenthil added a commit that referenced this pull request Feb 16, 2020
This reverts commit 82b5f6b.

The change broke the backwards compatibility of parsing behavior in a
patch release of Python (3.7.6). A decision was taken to revert this
patch in 3.7.7.

In https://bugs.python.org/issue27657 it was decided that the previous
behavior like

>>> urlparse('localhost:8080')
ParseResult(scheme='', netloc='', path='localhost:8080', params='', query='', fragment='')

>>> urlparse('undefined:8080')
ParseResult(scheme='', netloc='', path='undefined:8080', params='', query='', fragment='')

needs to be preserved in patch releases as number of users rely upon it.

Explicitly mention the releases involved with the revert in NEWS.
Adopt the wording suggested by @ned-deily.
@timgraham timgraham deleted the 27657 branch May 19, 2021 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants