bpo-46672: fix `NameError` in `asyncio.gather` if type check fails (GH-31187) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>