Skip to content

Conversation

@fatelei
Copy link

@fatelei fatelei commented Nov 12, 2025

Description

Add Flask 3.1+ compatibility with proper context cleanup for streaming responses to prevent memory leaks and token reuse

Fixes #3937

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@fatelei fatelei requested a review from a team as a code owner November 12, 2025 12:50
@fatelei fatelei force-pushed the flask_3.1 branch 5 times, most recently from 6c58d98 to a766911 Compare November 12, 2025 14:04
Copy link
Contributor

@xrmx xrmx left a comment

Choose a reason for hiding this comment

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

It looks to me that the diff is a lot bigger that what the fix would require, any chance that you can reduce that? We can do the refactoring later (or before) but all at the same commit is hard to review. Also we should add some tests with flask 3.1.

@fatelei
Copy link
Author

fatelei commented Nov 12, 2025

It looks to me that the diff is a lot bigger that what the fix would require, any chance that you can reduce that? We can do the refactoring later (or before) but all at the same commit is hard to review. Also we should add some tests with flask 3.1.

change it, make small change

@fatelei fatelei force-pushed the flask_3.1 branch 8 times, most recently from bc265d5 to 5a0cad1 Compare November 13, 2025 11:11
@fatelei fatelei force-pushed the flask_3.1 branch 3 times, most recently from 4ed9001 to 5c49c87 Compare November 14, 2025 13:49
@xrmx xrmx changed the title chore: compatiable flask 3.1+ flask: make it compatible with streaming responses in flask 3.1+ Nov 18, 2025
@xrmx xrmx moved this to Reviewed PRs that need fixes in @xrmx's Python PR digest Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Reviewed PRs that need fixes

Development

Successfully merging this pull request may close these issues.

flask: Context Detach Failure in Streaming Responses

2 participants