Commit 07035b7e authored by Jason Madden's avatar Jason Madden

Down to one failing test.

parent bd96d8e1
......@@ -110,14 +110,6 @@ class socket(_socketcommon.SocketMixin):
# don't subclass it. This lets code that needs the raw _sock (not tied to the hub)
# get it. This shows up in tests like test__example_udp_server.
if sys.version_info[:2] < (3, 7):
def __init__(self, family=AF_INET, type=SOCK_STREAM, proto=0, fileno=None):
super().__init__()
self._closed = False
self._sock = self._gevent_sock_class(family, type, proto, fileno)
self.timeout = None
self.__init_common()
else:
# In 3.7, socket changed to auto-detecting family, type, and proto
# when given a fileno.
def __init__(self, family=-1, type=-1, proto=-1, fileno=None):
......@@ -125,16 +117,14 @@ class socket(_socketcommon.SocketMixin):
self._closed = False
if fileno is None:
if family == -1:
family = AF_INET
family = AddressFamily.AF_INET
if type == -1:
type = SOCK_STREAM
if proto == -1:
proto = 0
self._sock = self._gevent_sock_class(family, type, proto, fileno)
self.timeout = None
self.__init_common()
def __init_common(self):
self._io_refs = 0
_socket.socket.setblocking(self._sock, False)
fileno = _socket.socket.fileno(self._sock)
......
......@@ -51,9 +51,6 @@ __imports__ = [
'setdefaulttimeout',
# Windows:
'errorTab',
]
__py3_imports__ = [
# Python 3
'AddressFamily',
'SocketKind',
......@@ -64,15 +61,15 @@ __py3_imports__ = [
'if_nameindex',
'if_nametoindex',
'sethostname',
'create_server',
'has_dualstack_ipv6',
]
__imports__.extend(__py3_imports__)
import time
from gevent._hub_local import get_hub_noargs as get_hub
from gevent._compat import string_types, integer_types, PY3
from gevent._compat import PY38
from gevent._compat import string_types, integer_types
from gevent._compat import PY39
from gevent._compat import WIN as is_windows
from gevent._compat import OSX as is_macos
......@@ -83,11 +80,6 @@ from gevent._hub_primitives import wait_on_socket as _wait_on_socket
from gevent.timeout import Timeout
if PY38:
__imports__.extend([
'create_server',
'has_dualstack_ipv6',
])
if PY39:
__imports__.extend([
......@@ -210,8 +202,7 @@ def gethostbyname_ex(hostname):
"""
return get_hub().resolver.gethostbyname_ex(hostname)
def getaddrinfo(host, port, family=0, socktype=0, proto=0, flags=0):
def getaddrinfo(host, port, family=0, type=0, proto=0, flags=0):
"""
Resolve host and port into list of address info entries.
......@@ -228,19 +219,6 @@ def getaddrinfo(host, port, family=0, socktype=0, proto=0, flags=0):
.. seealso:: :doc:`/dns`
"""
return get_hub().resolver.getaddrinfo(host, port, family, socktype, proto, flags)
if PY3:
# The name of the socktype param changed to type in Python 3.
# See https://github.com/gevent/gevent/issues/960
# Using inspect here to directly detect the condition is painful because we have to
# wrap it with a try/except TypeError because not all Python 2
# versions can get the args of a builtin; we also have to use a with to suppress
# the deprecation warning.
d = getaddrinfo.__doc__
def getaddrinfo(host, port, family=0, type=0, proto=0, flags=0):
# pylint:disable=function-redefined, undefined-variable
# Also, on Python 3, we need to translate into the special enums.
# Our lower-level resolvers, including the thread and blocking, which use _socket,
# function simply with integers.
......@@ -254,10 +232,7 @@ if PY3:
]
return result
getaddrinfo.__doc__ = d
del d
def _intenum_converter(value, enum_klass):
def _intenum_converter(value, enum_klass):
try:
return enum_klass(value)
except ValueError: # pragma: no cover
......@@ -546,8 +521,8 @@ class SocketMixin(object):
self.hub.cancel_wait(self._write_event, cancel_wait_ex)
self._sock.shutdown(how)
family = property(lambda self: self._sock.family)
type = property(lambda self: self._sock.type)
family = property(lambda self: _intenum_converter(self._sock.family, AddressFamily))
type = property(lambda self: _intenum_converter(self._sock.type, SocketKind))
proto = property(lambda self: self._sock.proto)
def fileno(self):
......
......@@ -123,7 +123,7 @@ def notify_and_call_entry_points(event):
# Prior to 3.9, there is no ``.module`` attribute, so if we
# needed that we'd have to look at the complete ``.value``
# attribute.
ep_dict = entry_points()
ep_dict = metadata.entry_points()
__traceback_info__ = ep_dict
# On Python 3.8, we can get duplicate EntryPoint objects; it is unclear
# why. Drop them into a set to make sure we only get one.
......
......@@ -115,17 +115,9 @@ def get_switch_expected(fullname):
disabled_tests = [
# "test an implementation detail of thread objects" --- our implementation differs
"test_threading.ThreadTests.test_tstate_lock",
# This likes to check the number of native thread IDs using the ``native_id`` attribute,
# and the ``get_native_id()`` function. Because we're monkey-patched,
# those don't change in other threads, so it won't work.
'test_threading.ThreadTests.test_various_ops',
# Added to address CPython issue 27718; it wants functions in the signal
# module to have __module__ equal to 'signal', but obviously when we
# monkey patch they don't.
# Want's __module__ to be 'signal', which of course it isn't once
# monkey-patched.
'test_signal.GenericTests.test_functions_module_attr',
# XXX: While we debug latest updates. This is leaking
'test_threading.ThreadTests.test_no_refcycle_through_target',
......@@ -268,13 +260,6 @@ disabled_tests = [
]
if sys.version_info[:3] < (2, 7, 18):
# The final release was 2.7.18. It added some new tests for new
# fixes. At this writing, AppVeyor is still on 2.7.17.
disabled_tests += [
'test_urllib2.MiscTests.test_url_host_with_control_char_rejected',
]
if OSX:
disabled_tests += [
# These are timing dependent, and sometimes run into the OS X
......@@ -548,15 +533,6 @@ class _PatchedTest(object):
return test
if sys.version_info[:3] <= (2, 7, 11):
disabled_tests += [
# These were added/fixed in 2.7.12+
'test_ssl.ThreadedTests.test__https_verify_certificates',
'test_ssl.ThreadedTests.test__https_verify_envvar',
]
if OSX:
disabled_tests += [
'test_subprocess.POSIXProcessTestCase.test_run_abort',
......@@ -644,7 +620,7 @@ if PYPY:
disabled_tests += [
disabled_tests += [
# Triggers the crash reporter
'test_threading.SubinterpThreadingTests.test_daemon_threads_fatal_error',
......@@ -698,8 +674,8 @@ if PYPY:
'test_socket.GeneralModuleTests.test_str_for_enums',
'test_socket.GeneralModuleTests.testGetaddrinfo',
]
if TRAVIS:
]
if TRAVIS:
disabled_tests += [
# test_cwd_with_relative_executable tends to fail
# on Travis...it looks like the test processes are stepping
......@@ -716,7 +692,7 @@ if PYPY:
'test_subprocess.RunFuncTestCase.test_run_with_shell_timeout_and_capture_output',
]
disabled_tests += [
disabled_tests += [
# XXX: BUG: We simply don't handle this correctly. On CPython,
# we wind up raising a BlockingIOError and then
# BrokenPipeError and then some random TypeErrors, all on the
......@@ -737,7 +713,7 @@ if PYPY:
# background.join() thinks that it is the current thread, and won't let it
# be joined.
'test_wsgiref.IntegrationTests.test_interrupted_write',
]
]
# PyPy3 3.5.5 v5.8-beta
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment