Skip to content

Commit

Permalink
Sync windows socketpair with Python 3.5+
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed Mar 22, 2019
1 parent 5f509a9 commit f8f1f48
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
7 changes: 3 additions & 4 deletions src/gevent/_socket3.py
Expand Up @@ -678,9 +678,8 @@ def socketpair(family=None, type=SOCK_STREAM, proto=0):
else: # pragma: no cover
# Origin: https://gist.github.com/4325783, by Geert Jansen. Public domain.

# gevent: taken from 3.6 release. Expected to be used only on Win. Added to Win/3.5
# gevent: for < 3.5, pass the default value of 128 to lsock.listen()
# (3.5+ uses this as a default and the original code passed no value)
# gevent: taken from 3.6 release, confirmed unchanged in 3.7 and
# 3.8a1. Expected to be used only on Win. Added to Win/3.5

_LOCALHOST = '127.0.0.1'
_LOCALHOST_V6 = '::1'
Expand All @@ -703,7 +702,7 @@ def socketpair(family=AF_INET, type=SOCK_STREAM, proto=0):
lsock = socket(family, type, proto)
try:
lsock.bind((host, 0))
lsock.listen(128)
lsock.listen()
# On IPv6, ignore flow_info and scope_id
addr, port = lsock.getsockname()[:2]
csock = socket(family, type, proto)
Expand Down
2 changes: 1 addition & 1 deletion src/gevent/tests/test__threading_monkey_in_thread.py
@@ -1,6 +1,6 @@
# We can monkey-patch in a thread, but things don't work as expected.
from __future__ import print_function
import sys

import threading
from gevent import monkey
import gevent.testing as greentest
Expand Down
1 change: 0 additions & 1 deletion src/gevent/threading.py
Expand Up @@ -157,7 +157,6 @@ def main_native_thread():

return main_threads[0]

import sys
if PY3:
# XXX: Issue 18808 breaks us on Python 3.4+.
# Thread objects now expect a callback from the interpreter itself
Expand Down

0 comments on commit f8f1f48

Please sign in to comment.