From c03c0a0b91cd13cb9bb3b798a9c454c7d286fbe6 Mon Sep 17 00:00:00 2001 From: Carl Andrie Ellepure Date: Thu, 23 Jul 2026 01:50:53 +0800 Subject: [PATCH] fix(client): log exceptions during client finalization instead of silently passing --- src/openai/_base_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openai/_base_client.py b/src/openai/_base_client.py index 3d7dda5afd..cd754d37c1 100644 --- a/src/openai/_base_client.py +++ b/src/openai/_base_client.py @@ -879,7 +879,7 @@ def __del__(self) -> None: try: self.close() except Exception: - pass + log.debug("Failed to auto-close client during finalization", exc_info=True) class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]): @@ -1505,7 +1505,7 @@ def __del__(self) -> None: # TODO(someday): support non asyncio runtimes here asyncio.get_running_loop().create_task(self.aclose()) except Exception: - pass + log.debug("Failed to schedule auto-close for async client during finalization", exc_info=True) class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):