From b45a7dab665e84a113bfbc6a261ef6e70d7887f8 Mon Sep 17 00:00:00 2001
From: "J. Nick Koston"
Date: Thu, 17 Oct 2024 15:39:52 -1000
Subject: [PATCH 1/3] Improve performance of creating the ConnectionKey (#9499)
---
aiohttp/client_reqrep.py | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/aiohttp/client_reqrep.py b/aiohttp/client_reqrep.py
index 9cc491669b..602d6da5f9 100644
--- a/aiohttp/client_reqrep.py
+++ b/aiohttp/client_reqrep.py
@@ -304,14 +304,17 @@ def connection_key(self) -> ConnectionKey:
else:
h = None
url = self.url
- return ConnectionKey(
- url.raw_host or "",
- url.port,
- url.scheme in _SSL_SCHEMES,
- self._ssl,
- self.proxy,
- self.proxy_auth,
- h,
+ return tuple.__new__(
+ ConnectionKey,
+ (
+ url.raw_host or "",
+ url.port,
+ url.scheme in _SSL_SCHEMES,
+ self._ssl,
+ self.proxy,
+ self.proxy_auth,
+ h,
+ ),
)
@property
From 13dc0200d855bdfec1d4c4f3e1c9a1c66f88f1eb Mon Sep 17 00:00:00 2001
From: "J. Nick Koston"
Date: Thu, 17 Oct 2024 15:54:26 -1000
Subject: [PATCH 2/3] Improve performance of WebSocketReader (#9498)
---
aiohttp/http_websocket.py | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/aiohttp/http_websocket.py b/aiohttp/http_websocket.py
index 268f1b624d..3fe7af4e32 100644
--- a/aiohttp/http_websocket.py
+++ b/aiohttp/http_websocket.py
@@ -124,8 +124,12 @@ def json(self, *, loads: Callable[[Any], Any] = json.loads) -> Any:
return loads(self.data)
-WS_CLOSED_MESSAGE = WSMessage(WSMsgType.CLOSED, None, None)
-WS_CLOSING_MESSAGE = WSMessage(WSMsgType.CLOSING, None, None)
+# Constructing the tuple directly to avoid the overhead of
+# the lambda and arg processing since NamedTuples are constructed
+# with a run time built lambda
+# https://github.com/python/cpython/blob/d83fcf8371f2f33c7797bc8f5423a8bca8c46e5c/Lib/collections/__init__.py#L441
+WS_CLOSED_MESSAGE = tuple.__new__(WSMessage, (WSMsgType.CLOSED, None, None))
+WS_CLOSING_MESSAGE = tuple.__new__(WSMessage, (WSMsgType.CLOSING, None, None))
class WebSocketError(Exception):
@@ -402,10 +406,14 @@ def _feed_data(self, data: bytes) -> None:
WSCloseCode.INVALID_TEXT, "Invalid UTF-8 text message"
) from exc
- self.queue.feed_data(WSMessage(WSMsgType.TEXT, text, ""))
+ # tuple.__new__ is used to avoid the overhead of the lambda
+ msg = tuple.__new__(WSMessage, (WSMsgType.TEXT, text, ""))
+ self.queue.feed_data(msg)
continue
- self.queue.feed_data(WSMessage(WSMsgType.BINARY, payload_merged, ""))
+ # tuple.__new__ is used to avoid the overhead of the lambda
+ msg = tuple.__new__(WSMessage, (WSMsgType.BINARY, payload_merged, ""))
+ self.queue.feed_data(msg)
elif opcode == WSMsgType.CLOSE:
if len(payload) >= 2:
close_code = UNPACK_CLOSE_CODE(payload[:2])[0]
@@ -420,22 +428,26 @@ def _feed_data(self, data: bytes) -> None:
raise WebSocketError(
WSCloseCode.INVALID_TEXT, "Invalid UTF-8 text message"
) from exc
- msg = WSMessage(WSMsgType.CLOSE, close_code, close_message)
+ msg = tuple.__new__(
+ WSMessage, (WSMsgType.CLOSE, close_code, close_message)
+ )
elif payload:
raise WebSocketError(
WSCloseCode.PROTOCOL_ERROR,
f"Invalid close frame: {fin} {opcode} {payload!r}",
)
else:
- msg = WSMessage(WSMsgType.CLOSE, 0, "")
+ msg = tuple.__new__(WSMessage, (WSMsgType.CLOSE, 0, ""))
self.queue.feed_data(msg)
elif opcode == WSMsgType.PING:
- self.queue.feed_data(WSMessage(WSMsgType.PING, payload, ""))
+ msg = tuple.__new__(WSMessage, (WSMsgType.PING, payload, ""))
+ self.queue.feed_data(msg)
elif opcode == WSMsgType.PONG:
- self.queue.feed_data(WSMessage(WSMsgType.PONG, payload, ""))
+ msg = tuple.__new__(WSMessage, (WSMsgType.PONG, payload, ""))
+ self.queue.feed_data(msg)
else:
raise WebSocketError(
From ced4fd31d828dbf7b96381e834199b01c5147e34 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 18 Oct 2024 11:18:39 +0000
Subject: [PATCH 3/3] Bump virtualenv from 20.26.6 to 20.27.0 (#9505)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Bumps [virtualenv](https://github.com/pypa/virtualenv) from 20.26.6 to
20.27.0.
Release notes
Sourced from virtualenv's
releases.
20.27.0
What's Changed
New Contributors
Full Changelog: https://github.com/pypa/virtualenv/compare/20.26.5...20.27.0
Changelog
Sourced from virtualenv's
changelog.
v20.27.0 (2024-10-17)
Features - 20.27.0
- Drop 3.7 support as the CI environments no longer allow it
running - by :user:`gaborbernat`. (:issue:`2758`)
Bugfixes - 20.27.0
-
When a $PATH
entry cannot be checked for existence, skip
it instead of terminating - by :user:hroncok
.
(:issue:2782
)
-
Upgrade embedded wheels:
- setuptools to
75.2.0
from 75.1.0
- Removed pip of
24.0
- Removed setuptools of
68.0.0
- Removed wheel of
0.42.0
- by :user:
gaborbernat
. (:issue:2783
)
-
Fix zipapp is broken on Windows post distlib 0.3.9
- by
:user:gaborbernat
. (:issue:2784
)
Commits
[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=virtualenv&package-manager=pip&previous-version=20.26.6&new-version=20.27.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
requirements/constraints.txt | 2 +-
requirements/dev.txt | 2 +-
requirements/lint.txt | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/requirements/constraints.txt b/requirements/constraints.txt
index 9dfdd94218..027ef7d709 100644
--- a/requirements/constraints.txt
+++ b/requirements/constraints.txt
@@ -267,7 +267,7 @@ uvloop==0.21.0 ; platform_system != "Windows"
# -r requirements/lint.in
valkey==6.0.2
# via -r requirements/lint.in
-virtualenv==20.26.6
+virtualenv==20.27.0
# via pre-commit
wait-for-it==2.2.2
# via -r requirements/test.in
diff --git a/requirements/dev.txt b/requirements/dev.txt
index 03721cd640..4cc84918f7 100644
--- a/requirements/dev.txt
+++ b/requirements/dev.txt
@@ -259,7 +259,7 @@ uvloop==0.21.0 ; platform_system != "Windows" and implementation_name == "cpytho
# -r requirements/lint.in
valkey==6.0.2
# via -r requirements/lint.in
-virtualenv==20.26.6
+virtualenv==20.27.0
# via pre-commit
wait-for-it==2.2.2
# via -r requirements/test.in
diff --git a/requirements/lint.txt b/requirements/lint.txt
index 6886d65555..75b00894db 100644
--- a/requirements/lint.txt
+++ b/requirements/lint.txt
@@ -120,5 +120,5 @@ uvloop==0.21.0 ; platform_system != "Windows"
# via -r requirements/lint.in
valkey==6.0.2
# via -r requirements/lint.in
-virtualenv==20.26.6
+virtualenv==20.27.0
# via pre-commit