Skip to content

Commit

Permalink
PYTHON-4907 Avoid noisy TypeError at interpreter exit (#2005)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaneHarvey authored Nov 18, 2024
1 parent 1894003 commit c9d9d7c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pymongo/asynchronous/mongo_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,8 @@ def __del__(self) -> None:
ResourceWarning,
stacklevel=2,
)
except AttributeError:
except (AttributeError, TypeError):
# Ignore errors at interpreter exit.
pass

def _close_cursor_soon(
Expand Down
3 changes: 2 additions & 1 deletion pymongo/synchronous/mongo_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,8 @@ def __del__(self) -> None:
ResourceWarning,
stacklevel=2,
)
except AttributeError:
except (AttributeError, TypeError):
# Ignore errors at interpreter exit.
pass

def _close_cursor_soon(
Expand Down

0 comments on commit c9d9d7c

Please sign in to comment.