]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-44229: Ignore spurious EPROTOTYPE on macOS in test_ssl (GH-26893) (GH-26895)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 24 Jun 2021 14:34:34 +0000 (07:34 -0700)
committerGitHub <noreply@github.com>
Thu, 24 Jun 2021 14:34:34 +0000 (15:34 +0100)
(cherry picked from commit b5a52eef67997246b4235b5407e52a01e822ce56)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
Lib/test/test_ssl.py

index 1fa024191893e654a21b1a8f076415c35ec4f807..32bb2aa37d320b94a974de0787e8512a9f53bbde 100644 (file)
@@ -2380,9 +2380,14 @@ class ThreadedEchoServer(threading.Thread):
                 self.server.conn_errors.append(str(e))
                 if self.server.chatty:
                     handle_error("\n server:  bad connection attempt from " + repr(self.addr) + ":\n")
-                self.running = False
-                self.server.stop()
-                self.close()
+
+                # bpo-44229, bpo-43855, bpo-44237, and bpo-33450:
+                # Ignore spurious EPROTOTYPE returned by write() on macOS.
+                # See also http://erickt.github.io/blog/2014/11/19/adventures-in-debugging-a-potential-osx-kernel-bug/
+                if e.errno != errno.EPROTOTYPE and sys.platform != "darwin":
+                    self.running = False
+                    self.server.stop()
+                    self.close()
                 return False
             else:
                 self.server.shared_ciphers.append(self.sslconn.shared_ciphers())