:issue:`1535`
- Fix how the native environment treats leading and trailing spaces
when parsing values on Python 3.10. :pr:`1537`
+- Improve async performance by avoiding checks for common types.
+ :issue:`1514`
Version 3.0.2
return decorator
+_common_primitives = {int, float, bool, str, list, dict, tuple, type(None)}
+
+
async def auto_await(value: t.Union[t.Awaitable["V"], "V"]) -> "V":
+ # Avoid a costly call to isawaitable
+ if type(value) in _common_primitives:
+ return t.cast("V", value)
+
if inspect.isawaitable(value):
return await t.cast("t.Awaitable[V]", value)