milesgranger commented on code in PR #14729:
URL: https://github.com/apache/arrow/pull/14729#discussion_r1033617447


##########
python/pyarrow/conftest.py:
##########
@@ -265,3 +267,19 @@ def add_fs(doctest_namespace, request, tmp_path):
         doctest_namespace["local_path"] = str(tmp_path)
         doctest_namespace["path"] = str(path)
     yield
+
+
[email protected](autouse=True)
+def _close_socket(monkeypatch):
+    """
+    There are occasions when a PytestUnraisableExceptionWarning is
+    raised from pyx files or other __del__ impls that doesn't properly
+    call the initial caller's .close when creating sockets. Here we'll
+    ensure sockets are closed.
+    """
+    class socket_(socket.socket):
+        def __del__(self):
+            if not self._closed:
+                self.close()

Review Comment:
   Yeah, this felt dirty. Commit has been dropped, I'll poke around at it a bit 
more.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to