Skip to content

Commit 774154e

Browse files
authored
PYTHON-3451 Stop passing bytes to getaddrinfo to fix eventlet support (#1066)
1 parent 85f0987 commit 774154e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

pymongo/pool.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -979,11 +979,9 @@ def _create_connection(address, options):
979979
This is a modified version of create_connection from CPython >= 2.7.
980980
"""
981981
host, port = address
982-
# Avoid the getaddrinfo importlib deadlock on fork() described in PYTHON-3406.
983-
host = host.encode("idna")
984982

985983
# Check if dealing with a unix domain socket
986-
if host.endswith(b".sock"):
984+
if host.endswith(".sock"):
987985
if not hasattr(socket, "AF_UNIX"):
988986
raise ConnectionFailure("UNIX-sockets are not supported on this system")
989987
sock = socket.socket(socket.AF_UNIX)
@@ -1000,7 +998,7 @@ def _create_connection(address, options):
1000998
# is 'localhost' (::1 is fine). Avoids slow connect issues
1001999
# like PYTHON-356.
10021000
family = socket.AF_INET
1003-
if socket.has_ipv6 and host != b"localhost":
1001+
if socket.has_ipv6 and host != "localhost":
10041002
family = socket.AF_UNSPEC
10051003

10061004
err = None

0 commit comments

Comments
 (0)