From abb526ff94e68c7a16cc82a79b05000f16174b62 Mon Sep 17 00:00:00 2001 From: kirill-stepanishin Date: Tue, 2 Dec 2025 06:07:46 -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 2997296fc..d9a13e535 100644 --- a/src/neo4j/_async/io/_bolt3.py +++ b/src/neo4j/_async/io/_bolt3.py @@ -591,7 +591,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 3f4c93a3b..80e1eb5e9 100644 --- a/src/neo4j/_sync/io/_bolt3.py +++ b/src/neo4j/_sync/io/_bolt3.py @@ -591,7 +591,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)