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
8d001495
Commit
8d001495
authored
Jun 04, 2020
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add backports.socketpair as test/recommended extra on Windows/Py2
We use it in our selector tests.
parent
ae5d62d2
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
41 additions
and
15 deletions
+41
-15
appveyor.yml
appveyor.yml
+5
-5
docs/install.rst
docs/install.rst
+7
-1
setup.py
setup.py
+2
-0
src/gevent/_abstract_linkable.py
src/gevent/_abstract_linkable.py
+4
-0
src/gevent/_socket2.py
src/gevent/_socket2.py
+16
-1
src/gevent/_socketcommon.py
src/gevent/_socketcommon.py
+5
-0
src/gevent/tests/known_failures.py
src/gevent/tests/known_failures.py
+0
-8
src/gevent/tests/test__socketpair.py
src/gevent/tests/test__socketpair.py
+2
-0
No files found.
appveyor.yml
View file @
8d001495
...
...
@@ -40,6 +40,11 @@ environment:
# a later point release.
# 64-bit
-
PYTHON
:
"
C:
\\
Python27-x64"
PYTHON_VERSION
:
"
2.7.x"
# currently 2.7.13
PYTHON_ARCH
:
"
64"
PYTHON_EXE
:
python
-
PYTHON
:
"
C:
\\
Python38-x64"
PYTHON_VERSION
:
"
3.8.x"
PYTHON_ARCH
:
"
64"
...
...
@@ -50,11 +55,6 @@ environment:
PYTHON_ARCH
:
"
64"
PYTHON_EXE
:
python
-
PYTHON
:
"
C:
\\
Python27-x64"
PYTHON_VERSION
:
"
2.7.x"
# currently 2.7.13
PYTHON_ARCH
:
"
64"
PYTHON_EXE
:
python
-
PYTHON
:
"
C:
\\
Python36-x64"
PYTHON_VERSION
:
"
3.6.x"
# currently 3.6.0
PYTHON_ARCH
:
"
64"
...
...
docs/install.rst
View file @
8d001495
...
...
@@ -146,7 +146,13 @@ monitor
build on all platforms.)
recommended
A shortcut for installing suggested extras together.
A shortcut for installing suggested extras together. This includes
the non-test extras defined here, plus:
- `backports.socketpair
<https://pypi.org/project/backports.socketpair/>`_ on Python
2/Windows (beginning with release 20.6.0);
- `selectors2 <https://pypi.org/project/selectors2/>`_ on Python 2 (beginning with release 20.6.0).
test
Everything needed to run the complete gevent test suite.
...
...
setup.py
View file @
8d001495
...
...
@@ -317,6 +317,8 @@ EXTRA_RECOMMENDED = [
CFFI_DEP
,
# Backport of selectors module to Python 2
'selectors2 ; python_version == "2.7"'
,
# Backport of socket.socketpair to Python 2; only needed on Windows
'backports.socketpair ; python_version == "2.7" and sys_platform == "win32"'
,
]
+
EXTRA_DNSPYTHON
+
EXTRA_EVENTS
+
EXTRA_MONITOR
...
...
src/gevent/_abstract_linkable.py
View file @
8d001495
...
...
@@ -194,6 +194,10 @@ class AbstractLinkable(object):
# The object itself becomes false in a boolean way as soon
# as this method returns.
notifier
=
self
.
_notifier
if
notifier
is
None
:
# XXX: How did we get here?
self
.
_check_and_notify
()
return
# Early links are allowed to remove later links, and links
# are allowed to add more links, thus we must not
# make a copy of our the ``_links`` list, we must traverse it and
...
...
src/gevent/_socket2.py
View file @
8d001495
...
...
@@ -460,7 +460,8 @@ class socket(_socketcommon.SocketMixin):
SocketType
=
socket
if
hasattr
(
_socket
,
'socketpair'
):
# The native, low-level socketpair returns
# low-level objects
def
socketpair
(
family
=
getattr
(
_socket
,
'AF_UNIX'
,
_socket
.
AF_INET
),
type
=
_socket
.
SOCK_STREAM
,
proto
=
0
):
one
,
two
=
_socket
.
socketpair
(
family
,
type
,
proto
)
...
...
@@ -469,6 +470,20 @@ if hasattr(_socket, 'socketpair'):
one
.
_drop
()
two
.
_drop
()
return
result
elif
hasattr
(
__socket__
,
'socketpair'
):
# The high-level backport uses high-level socket APIs. It works
# cooperatively automatically if we're monkey-patched,
# else we must do it ourself.
_orig_socketpair
=
__socket__
.
socketpair
def
socketpair
(
*
args
,
**
kwargs
):
one
,
two
=
_orig_socketpair
(
*
args
,
**
kwargs
)
if
not
isinstance
(
one
,
socket
):
one
=
socket
(
_sock
=
one
)
two
=
socket
(
_sock
=
two
)
if
PYPY
:
one
.
_drop
()
two
.
_drop
()
return
one
,
two
elif
'socketpair'
in
__implements__
:
__implements__
.
remove
(
'socketpair'
)
...
...
src/gevent/_socketcommon.py
View file @
8d001495
...
...
@@ -128,6 +128,11 @@ if is_macos:
import
_socket
_realsocket
=
_socket
.
socket
import
socket
as
__socket__
try
:
# Provide implementation of socket.socketpair on Windows < 3.5.
import
backports.socketpair
except
ImportError
:
pass
_name
=
_value
=
None
__imports__
=
copy_globals
(
__socket__
,
globals
(),
...
...
src/gevent/tests/known_failures.py
View file @
8d001495
...
...
@@ -259,14 +259,6 @@ class Definitions(DefinitionsBase):
when
=
APPVEYOR
&
PY3
)
test__socketpair
=
Ignored
(
"""
Py35 added socket.socketpair, all other releases
are missing it. No reason to even test it.
"""
,
when
=
WIN
&
PY2
)
test_ftplib
=
Flaky
(
r"""
could be a problem of appveyor - not sure
...
...
src/gevent/tests/test__socketpair.py
View file @
8d001495
...
...
@@ -15,6 +15,8 @@ class TestSocketpair(unittest.TestCase):
self
.
assertEqual
(
msg
,
read
)
y
.
close
()
@
unittest
.
skipUnless
(
hasattr
(
socket
,
'fromfd'
),
'Needs socket.fromfd'
)
def
test_fromfd
(
self
):
msg
=
b'hello world'
x
,
y
=
socket
.
socketpair
()
...
...
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