From 9e31ac2e3ff66048bb26ee407851c3ffaed592f7 Mon Sep 17 00:00:00 2001 From: Robsdedude Date: Tue, 28 Nov 2023 11:29:12 +0100 Subject: [PATCH] Fix generator wrapper of concurrency guard --- src/neo4j/_async/_debug/_concurrency_check.py | 2 ++ src/neo4j/_sync/_debug/_concurrency_check.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/neo4j/_async/_debug/_concurrency_check.py b/src/neo4j/_async/_debug/_concurrency_check.py index 478884921..afb54a4f2 100644 --- a/src/neo4j/_async/_debug/_concurrency_check.py +++ b/src/neo4j/_async/_debug/_concurrency_check.py @@ -131,6 +131,8 @@ async def inner(*args, **kwargs): if acquired: try: item = await iter_.__anext__() + except StopAsyncIteration: + return finally: async with self.__tracebacks_lock: self.__tracebacks.pop() diff --git a/src/neo4j/_sync/_debug/_concurrency_check.py b/src/neo4j/_sync/_debug/_concurrency_check.py index 6a5ef9b3c..e5da4f252 100644 --- a/src/neo4j/_sync/_debug/_concurrency_check.py +++ b/src/neo4j/_sync/_debug/_concurrency_check.py @@ -131,6 +131,8 @@ def inner(*args, **kwargs): if acquired: try: item = iter_.__next__() + except StopIteration: + return finally: with self.__tracebacks_lock: self.__tracebacks.pop()