Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
07035b7e
Commit
07035b7e
authored
Jul 07, 2023
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Down to one failing test.
parent
bd96d8e1
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
132 additions
and
191 deletions
+132
-191
src/gevent/_socket3.py
src/gevent/_socket3.py
+15
-25
src/gevent/_socketcommon.py
src/gevent/_socketcommon.py
+24
-49
src/gevent/events.py
src/gevent/events.py
+1
-1
src/gevent/testing/patched_tests_setup.py
src/gevent/testing/patched_tests_setup.py
+92
-116
No files found.
src/gevent/_socket3.py
View file @
07035b7e
...
@@ -110,31 +110,21 @@ class socket(_socketcommon.SocketMixin):
...
@@ -110,31 +110,21 @@ class socket(_socketcommon.SocketMixin):
# don't subclass it. This lets code that needs the raw _sock (not tied to the hub)
# 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.
# get it. This shows up in tests like test__example_udp_server.
if
sys
.
version_info
[:
2
]
<
(
3
,
7
):
# In 3.7, socket changed to auto-detecting family, type, and proto
def
__init__
(
self
,
family
=
AF_INET
,
type
=
SOCK_STREAM
,
proto
=
0
,
fileno
=
None
):
# when given a fileno.
super
().
__init__
()
def
__init__
(
self
,
family
=-
1
,
type
=-
1
,
proto
=-
1
,
fileno
=
None
):
self
.
_closed
=
False
super
().
__init__
()
self
.
_sock
=
self
.
_gevent_sock_class
(
family
,
type
,
proto
,
fileno
)
self
.
_closed
=
False
self
.
timeout
=
None
if
fileno
is
None
:
self
.
__init_common
()
if
family
==
-
1
:
else
:
family
=
AddressFamily
.
AF_INET
# In 3.7, socket changed to auto-detecting family, type, and proto
if
type
==
-
1
:
# when given a fileno.
type
=
SOCK_STREAM
def
__init__
(
self
,
family
=-
1
,
type
=-
1
,
proto
=-
1
,
fileno
=
None
):
if
proto
==
-
1
:
super
().
__init__
()
proto
=
0
self
.
_closed
=
False
self
.
_sock
=
self
.
_gevent_sock_class
(
family
,
type
,
proto
,
fileno
)
if
fileno
is
None
:
self
.
timeout
=
None
if
family
==
-
1
:
family
=
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
self
.
_io_refs
=
0
_socket
.
socket
.
setblocking
(
self
.
_sock
,
False
)
_socket
.
socket
.
setblocking
(
self
.
_sock
,
False
)
fileno
=
_socket
.
socket
.
fileno
(
self
.
_sock
)
fileno
=
_socket
.
socket
.
fileno
(
self
.
_sock
)
...
...
src/gevent/_socketcommon.py
View file @
07035b7e
...
@@ -51,9 +51,6 @@ __imports__ = [
...
@@ -51,9 +51,6 @@ __imports__ = [
'setdefaulttimeout'
,
'setdefaulttimeout'
,
# Windows:
# Windows:
'errorTab'
,
'errorTab'
,
]
__py3_imports__
=
[
# Python 3
# Python 3
'AddressFamily'
,
'AddressFamily'
,
'SocketKind'
,
'SocketKind'
,
...
@@ -64,15 +61,15 @@ __py3_imports__ = [
...
@@ -64,15 +61,15 @@ __py3_imports__ = [
'if_nameindex'
,
'if_nameindex'
,
'if_nametoindex'
,
'if_nametoindex'
,
'sethostname'
,
'sethostname'
,
'create_server'
,
'has_dualstack_ipv6'
,
]
]
__imports__
.
extend
(
__py3_imports__
)
import
time
import
time
from
gevent._hub_local
import
get_hub_noargs
as
get_hub
from
gevent._hub_local
import
get_hub_noargs
as
get_hub
from
gevent._compat
import
string_types
,
integer_types
,
PY3
from
gevent._compat
import
string_types
,
integer_types
from
gevent._compat
import
PY38
from
gevent._compat
import
PY39
from
gevent._compat
import
PY39
from
gevent._compat
import
WIN
as
is_windows
from
gevent._compat
import
WIN
as
is_windows
from
gevent._compat
import
OSX
as
is_macos
from
gevent._compat
import
OSX
as
is_macos
...
@@ -83,11 +80,6 @@ from gevent._hub_primitives import wait_on_socket as _wait_on_socket
...
@@ -83,11 +80,6 @@ from gevent._hub_primitives import wait_on_socket as _wait_on_socket
from
gevent.timeout
import
Timeout
from
gevent.timeout
import
Timeout
if
PY38
:
__imports__
.
extend
([
'create_server'
,
'has_dualstack_ipv6'
,
])
if
PY39
:
if
PY39
:
__imports__
.
extend
([
__imports__
.
extend
([
...
@@ -210,8 +202,7 @@ def gethostbyname_ex(hostname):
...
@@ -210,8 +202,7 @@ def gethostbyname_ex(hostname):
"""
"""
return
get_hub
().
resolver
.
gethostbyname_ex
(
hostname
)
return
get_hub
().
resolver
.
gethostbyname_ex
(
hostname
)
def
getaddrinfo
(
host
,
port
,
family
=
0
,
type
=
0
,
proto
=
0
,
flags
=
0
):
def
getaddrinfo
(
host
,
port
,
family
=
0
,
socktype
=
0
,
proto
=
0
,
flags
=
0
):
"""
"""
Resolve host and port into list of address info entries.
Resolve host and port into list of address info entries.
...
@@ -228,40 +219,24 @@ def getaddrinfo(host, port, family=0, socktype=0, proto=0, flags=0):
...
@@ -228,40 +219,24 @@ def getaddrinfo(host, port, family=0, socktype=0, proto=0, flags=0):
.. seealso:: :doc:`/dns`
.. seealso:: :doc:`/dns`
"""
"""
return
get_hub
().
resolver
.
getaddrinfo
(
host
,
port
,
family
,
socktype
,
proto
,
flags
)
# Also, on Python 3, we need to translate into the special enums.
# Our lower-level resolvers, including the thread and blocking, which use _socket,
if
PY3
:
# function simply with integers.
# The name of the socktype param changed to type in Python 3.
addrlist
=
get_hub
().
resolver
.
getaddrinfo
(
host
,
port
,
family
,
type
,
proto
,
flags
)
# See https://github.com/gevent/gevent/issues/960
result
=
[
# Using inspect here to directly detect the condition is painful because we have to
(
_intenum_converter
(
af
,
AddressFamily
),
# wrap it with a try/except TypeError because not all Python 2
_intenum_converter
(
socktype
,
SocketKind
),
# versions can get the args of a builtin; we also have to use a with to suppress
proto
,
canonname
,
sa
)
# the deprecation warning.
for
af
,
socktype
,
proto
,
canonname
,
sa
d
=
getaddrinfo
.
__doc__
in
addrlist
]
def
getaddrinfo
(
host
,
port
,
family
=
0
,
type
=
0
,
proto
=
0
,
flags
=
0
):
return
result
# pylint:disable=function-redefined, undefined-variable
# Also, on Python 3, we need to translate into the special enums.
def
_intenum_converter
(
value
,
enum_klass
):
# Our lower-level resolvers, including the thread and blocking, which use _socket,
try
:
# function simply with integers.
return
enum_klass
(
value
)
addrlist
=
get_hub
().
resolver
.
getaddrinfo
(
host
,
port
,
family
,
type
,
proto
,
flags
)
except
ValueError
:
# pragma: no cover
result
=
[
return
value
(
_intenum_converter
(
af
,
AddressFamily
),
_intenum_converter
(
socktype
,
SocketKind
),
proto
,
canonname
,
sa
)
for
af
,
socktype
,
proto
,
canonname
,
sa
in
addrlist
]
return
result
getaddrinfo
.
__doc__
=
d
del
d
def
_intenum_converter
(
value
,
enum_klass
):
try
:
return
enum_klass
(
value
)
except
ValueError
:
# pragma: no cover
return
value
def
gethostbyaddr
(
ip_address
):
def
gethostbyaddr
(
ip_address
):
...
@@ -546,8 +521,8 @@ class SocketMixin(object):
...
@@ -546,8 +521,8 @@ class SocketMixin(object):
self
.
hub
.
cancel_wait
(
self
.
_write_event
,
cancel_wait_ex
)
self
.
hub
.
cancel_wait
(
self
.
_write_event
,
cancel_wait_ex
)
self
.
_sock
.
shutdown
(
how
)
self
.
_sock
.
shutdown
(
how
)
family
=
property
(
lambda
self
:
self
.
_sock
.
family
)
family
=
property
(
lambda
self
:
_intenum_converter
(
self
.
_sock
.
family
,
AddressFamily
)
)
type
=
property
(
lambda
self
:
self
.
_sock
.
type
)
type
=
property
(
lambda
self
:
_intenum_converter
(
self
.
_sock
.
type
,
SocketKind
)
)
proto
=
property
(
lambda
self
:
self
.
_sock
.
proto
)
proto
=
property
(
lambda
self
:
self
.
_sock
.
proto
)
def
fileno
(
self
):
def
fileno
(
self
):
...
...
src/gevent/events.py
View file @
07035b7e
...
@@ -123,7 +123,7 @@ def notify_and_call_entry_points(event):
...
@@ -123,7 +123,7 @@ def notify_and_call_entry_points(event):
# Prior to 3.9, there is no ``.module`` attribute, so if we
# Prior to 3.9, there is no ``.module`` attribute, so if we
# needed that we'd have to look at the complete ``.value``
# needed that we'd have to look at the complete ``.value``
# attribute.
# attribute.
ep_dict
=
entry_points
()
ep_dict
=
metadata
.
entry_points
()
__traceback_info__
=
ep_dict
__traceback_info__
=
ep_dict
# On Python 3.8, we can get duplicate EntryPoint objects; it is unclear
# 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.
# why. Drop them into a set to make sure we only get one.
...
...
src/gevent/testing/patched_tests_setup.py
View file @
07035b7e
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment