-
-
Notifications
You must be signed in to change notification settings - Fork 37.4k
Suggest async with when with finds no __enter__/__exit__ #128398
Copy link
Copy link
Closed
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement
Description
Activity
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement
Bug report
Bug description:
(This is not an asyncio bug! I am just using
asyncio.TaskGroup()as an example.)This currently gives an error ending in
That's not very clear about what's wrong. Maybe when issuing this
TypeErrorwe could check if the object supports__aexit__and__aenter__, and if so, suggest something like "maybe tryasync with?".CPython versions tested on:
3.12, 3.13, 3.14
Operating systems tested on:
No response
Linked PRs
withandasync with#132218