From 381810bee84e09477ab674a285ee020322d761de Mon Sep 17 00:00:00 2001 From: Kirill Stepanishin Date: Thu, 27 Nov 2025 13:27:45 -0800 Subject: [PATCH] Fix AttributeError when pool is None in Bolt3 error handling Add null check for self.pool before calling on_neo4j_error() in async Bolt3 implementation to prevent AttributeError when the connection pool is not available during Neo4jError handling. --- src/neo4j/_async/io/_bolt3.py | 3 ++- src/neo4j/_sync/io/_bolt3.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/neo4j/_async/io/_bolt3.py b/src/neo4j/_async/io/_bolt3.py index 773f6e712..a104c623b 100644 --- a/src/neo4j/_async/io/_bolt3.py +++ b/src/neo4j/_async/io/_bolt3.py @@ -588,7 +588,8 @@ async def _process_message(self, tag, fields): ) raise except Neo4jError as e: - await self.pool.on_neo4j_error(e, self) + if self.pool: + await self.pool.on_neo4j_error(e, self) raise else: sig_int = ord(summary_signature) diff --git a/src/neo4j/_sync/io/_bolt3.py b/src/neo4j/_sync/io/_bolt3.py index a66f3ead4..9e548e3bc 100644 --- a/src/neo4j/_sync/io/_bolt3.py +++ b/src/neo4j/_sync/io/_bolt3.py @@ -588,7 +588,8 @@ def _process_message(self, tag, fields): ) raise except Neo4jError as e: - self.pool.on_neo4j_error(e, self) + if self.pool: + self.pool.on_neo4j_error(e, self) raise else: sig_int = ord(summary_signature)