From 5e9a2bdbd7d10670061e2861fb58df0e246c6300 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 13 Oct 2024 12:02:44 -0500 Subject: [PATCH] Improve performance of constructing query strings with ``int`` values --- yarl/_url.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/yarl/_url.py b/yarl/_url.py index abc926414..19b27bec8 100644 --- a/yarl/_url.py +++ b/yarl/_url.py @@ -1288,6 +1288,8 @@ def _query_var(v: QueryVariable) -> str: if math.isnan(v): raise ValueError("float('nan') is not supported") return str(float(v)) + if cls is int: + return str(v) if cls is not bool and isinstance(cls, SupportsInt): return str(int(v)) raise TypeError(