From efe096a2b4013c18b1c63856319fc1f74957f625 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sat, 17 Jun 2023 17:56:53 +0300 Subject: [PATCH] callers: do `.close()` also in the `throw` case No reason to not do it also for exceptions. Was a thinko. --- src/pluggy/_callers.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pluggy/_callers.py b/src/pluggy/_callers.py index d8f0dba7..6417472a 100644 --- a/src/pluggy/_callers.py +++ b/src/pluggy/_callers.py @@ -104,10 +104,10 @@ def _multicall( teardown.throw(outcome._exception) else: teardown.send(outcome._result) - # Following is unreachable for a well behaved hook wrapper. - # Try to force finalizers otherwise postponed till GC action. - # Note: close() may raise if generator handles GeneratorExit. - teardown.close() + # Following is unreachable for a well behaved hook wrapper. + # Try to force finalizers otherwise postponed till GC action. + # Note: close() may raise if generator handles GeneratorExit. + teardown.close() except StopIteration as si: outcome.force_result(si.value) continue