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

Support Python 3.13 #2662

Merged
merged 4 commits into from
Aug 6, 2024
Merged

Support Python 3.13 #2662

merged 4 commits into from
Aug 6, 2024

Conversation

Kludex
Copy link
Sponsor Member

@Kludex Kludex commented Aug 6, 2024

No description provided.

@Kludex Kludex marked this pull request as ready for review August 6, 2024 10:34
@@ -42,6 +42,7 @@ def __init__(self, app: ASGIApp, minimum_size: int, compresslevel: int = 9) -> N
async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
self.send = send
await self.app(scope, receive, self.send_with_gzip)
self.gzip_file.close()
Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

@graingert Is this good enough?

Copy link
Member

@graingert graingert Aug 6, 2024

Choose a reason for hiding this comment

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

You might want to do it in a finally, or even better use with

with BytesIO() as buffer, GzipFile(..., buffer) as gzip_file:
    await self.app(scope, receive, functools.partial(self.send_with_gzip, buffer, gzip_file))

@musicinmybrain
Copy link

I tried this PR as a patch for python-starlette in Fedora Rawhide, and I can confirm that it appears to fix all of the Python 3.13 test regressions from #2614 and #2615.

I do like @graingert’s suggestion in #2662 (comment), though.

Copy link
Member

@adriangb adriangb left a comment

Choose a reason for hiding this comment

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

Approving pending #2662 (comment) being applied

@Kludex Kludex requested a review from graingert August 6, 2024 15:01
@Kludex Kludex merged commit 55cbba9 into master Aug 6, 2024
6 checks passed
@Kludex Kludex deleted the support-3.13 branch August 6, 2024 15:08
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.

4 participants