AI junk - #6113
Closed
alaramartin wants to merge 1 commit into
Closed
Conversation
…of `.partition(":")`?
Member
.partition(":")?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Root cause
The
.partition(':')method incorrectly splits IPv6 addresses, leading to broken session transaction handling and Flask server configuration.What changed
The
EnvironBuilderclass now usesurlparseinstead of.partition(':')to handle URLs, including IPv6 addresses. TheFlaskClient.openmethod was simplified by removing unnecessary context stack handling.Why this fixes it
By using
urlparse, the new implementation correctly handles both IPv4 and IPv6 addresses without breaking on colons. This resolves issues with session transactions and server name parsing inFlask.run()for IPv6 addresses.Before / after
src/flask/testing.py(+16 -157)Why this was ranked here
src/flask/testing.pyBlast radius is computed by walking this repo's import graph, not by reading the issue text.
Linked issues (1)
.partition(":")? #6093 - IPv6 addresses parsed incorrectly because of.partition(":")?What to check
Reviewers should ensure that the change does not introduce any unintended side effects, such as changes in URL parsing behavior for non-IPv6 URLs. Additionally, edge cases involving complex URL structures should be thoroughly tested.
Suggested test
A test case should be added to
test_session_transaction_ipv6where a request is made with an IPv6 address and the session value is correctly set and retrieved.Opened by Triage. A human clicked Generate PR - nothing here merges itself.