Only set shield flag when trio nursery mode is used

pull/26/head
Guillermo Rodriguez 2025-04-13 14:16:39 -03:00
parent 4e8404bb09
commit ef6094a650
No known key found for this signature in database
GPG Key ID: 002CC5F1E6BDA53E
1 changed files with 2 additions and 1 deletions

View File

@ -70,7 +70,8 @@ async def maybe_open_nursery(
yield nursery
else:
async with lib.open_nursery(**kwargs) as nursery:
nursery.cancel_scope.shield = shield
if lib == trio:
nursery.cancel_scope.shield = shield
yield nursery