Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Support Python 3.13#2662

Merged
Kludex merged 4 commits intomasterfrom
support-3.13
Aug 6, 2024
Merged

Support Python 3.13#2662
Kludex merged 4 commits intomasterfrom
support-3.13

Conversation

@Kludex
Copy link
Owner

@Kludex Kludex commented Aug 6, 2024

No description provided.

@Kludex Kludex marked this pull request as ready for review August 6, 2024 10:34
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
Owner 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
Contributor

@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
Contributor

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
Contributor

@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
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