Skip to content

Commit 4782275

Browse files
authored
Improve performance of constructing query strings with int values (#1259)
1 parent 5d6ff6c commit 4782275

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

CHANGES/1259.misc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Improved performance of constructing query strings with ``int`` values -- by :user:`bdraco`.

yarl/_url.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,6 +1280,8 @@ def _query_var(v: QueryVariable) -> str:
12801280
if TYPE_CHECKING:
12811281
assert isinstance(v, str)
12821282
return v
1283+
if cls is int: # Fast path for non-subclassed int
1284+
return str(v)
12831285
if issubclass(cls, float):
12841286
if TYPE_CHECKING:
12851287
assert isinstance(v, float)

0 commit comments

Comments
 (0)