Skip to content

Commit c9d9d7c

Browse files
authored
PYTHON-4907 Avoid noisy TypeError at interpreter exit (mongodb#2005)
1 parent 1894003 commit c9d9d7c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

pymongo/asynchronous/mongo_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1195,7 +1195,8 @@ def __del__(self) -> None:
11951195
ResourceWarning,
11961196
stacklevel=2,
11971197
)
1198-
except AttributeError:
1198+
except (AttributeError, TypeError):
1199+
# Ignore errors at interpreter exit.
11991200
pass
12001201

12011202
def _close_cursor_soon(

pymongo/synchronous/mongo_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1193,7 +1193,8 @@ def __del__(self) -> None:
11931193
ResourceWarning,
11941194
stacklevel=2,
11951195
)
1196-
except AttributeError:
1196+
except (AttributeError, TypeError):
1197+
# Ignore errors at interpreter exit.
11971198
pass
11981199

11991200
def _close_cursor_soon(

0 commit comments

Comments
 (0)