Skip to content

Support Python 3.13 - #2662

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

Kludex merged 4 commits into
masterfrom
support-3.13

Conversation

@Kludex

@Kludex Kludex commented Aug 6, 2024

Copy link
Copy Markdown
Owner

No description provided.

@Kludex
Kludex marked this pull request as ready for review August 6, 2024 10:34
Comment thread starlette/middleware/gzip.py Outdated
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
Copy Markdown
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?

@graingert graingert Aug 6, 2024

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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鈥檚 suggestion in #2662 (comment), though.

@adriangb adriangb left a comment

Copy link
Copy Markdown
Contributor

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