Skip to content

Prevent Response self-reference in redirect history#7328

Merged
nateprewitt merged 1 commit intopsf:mainfrom
nateprewitt:history_pruning
Apr 5, 2026
Merged

Prevent Response self-reference in redirect history#7328
nateprewitt merged 1 commit intopsf:mainfrom
nateprewitt:history_pruning

Conversation

@nateprewitt
Copy link
Copy Markdown
Member

This PR should address #6295, avoiding the unnecessary addition of the current response in its own redirect history. Ideally, we should remove intermediate .history assignment entirely, as Session.send() overwrites it on the final response anyway. The intermediary behavior introduces a number of issues both in intuitiveness and a reference explosion delaying the objects being properly cleaned up after use.

That's unfortunately a breaking change we'll have to wait on, but this should fix the immediate issue for now.

@nateprewitt nateprewitt merged commit ef439eb into psf:main Apr 5, 2026
28 checks passed
@nateprewitt nateprewitt deleted the history_pruning branch April 5, 2026 15:31
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.

2 participants