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
88663a4a
Commit
88663a4a
authored
Jun 30, 2015
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch selectors on Python 3.4. Fixes #591
parent
41bf3e23
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
486 additions
and
5 deletions
+486
-5
changelog.rst
changelog.rst
+2
-1
gevent/monkey.py
gevent/monkey.py
+13
-2
greentest/3.4/test_selectors.py
greentest/3.4/test_selectors.py
+467
-0
greentest/3.4/version
greentest/3.4/version
+1
-0
greentest/test___monkey_patching.py
greentest/test___monkey_patching.py
+2
-1
greentest/testrunner.py
greentest/testrunner.py
+1
-1
No files found.
changelog.rst
View file @
88663a4a
...
@@ -17,7 +17,8 @@ Unreleased
...
@@ -17,7 +17,8 @@ Unreleased
``gevent.pool.Group``/``Pool`` and the builtin ``apply`` function.
``gevent.pool.Group``/``Pool`` and the builtin ``apply`` function.
This obsoletes the undocumented ``apply_e`` function. Original PR
This obsoletes the undocumented ``apply_e`` function. Original PR
#556 by Robert Estelle.
#556 by Robert Estelle.
- Monkey-patch the ``selectors`` module from ``patch_all`` and
``patch_select`` on Python 3.4. See #591.
1.1a1 (Jun 29, 2015)
1.1a1 (Jun 29, 2015)
====================
====================
...
...
gevent/monkey.py
View file @
88663a4a
...
@@ -204,7 +204,8 @@ def patch_ssl():
...
@@ -204,7 +204,8 @@ def patch_ssl():
def
patch_select
(
aggressive
=
True
):
def
patch_select
(
aggressive
=
True
):
"""Replace :func:`select.select` with :func:`gevent.select.select`.
"""Replace :func:`select.select` with :func:`gevent.select.select`.
If aggressive is true (the default), also remove other blocking functions the :mod:`select`.
If ``aggressive`` is true (the default), also remove other blocking functions from :mod:`select`
and (on Python 3.4 and above) :mod:`selectors`.
"""
"""
patch_module
(
'select'
)
patch_module
(
'select'
)
if
aggressive
:
if
aggressive
:
...
@@ -219,7 +220,8 @@ def patch_select(aggressive=True):
...
@@ -219,7 +220,8 @@ def patch_select(aggressive=True):
if
sys
.
version_info
[:
2
]
>=
(
3
,
4
):
if
sys
.
version_info
[:
2
]
>=
(
3
,
4
):
# Python 3 wants to use `select.select` as a member function,
# Python 3 wants to use `select.select` as a member function,
# leading to this error in selectors.py
# leading to this error in selectors.py (because gevent.select.select is
# not a builtin and doesn't get the magic auto-static that they do)
# r, w, _ = self._select(self._readers, self._writers, [], timeout)
# r, w, _ = self._select(self._readers, self._writers, [], timeout)
# TypeError: select() takes from 3 to 4 positional arguments but 5 were given
# TypeError: select() takes from 3 to 4 positional arguments but 5 were given
select
=
__import__
(
'select'
)
select
=
__import__
(
'select'
)
...
@@ -229,6 +231,15 @@ def patch_select(aggressive=True):
...
@@ -229,6 +231,15 @@ def patch_select(aggressive=True):
return
select
.
select
(
*
args
,
**
kwargs
)
return
select
.
select
(
*
args
,
**
kwargs
)
selectors
.
SelectSelector
.
_select
=
_select
selectors
.
SelectSelector
.
_select
=
_select
if
aggressive
:
# If `selectors` had already been imported before we removed
# select.poll|epoll|kqueue, these may have been defined in terms
# of those functions. They'll fail at runtime.
remove_item
(
selectors
,
'PollSelector'
)
remove_item
(
selectors
,
'EpollSelector'
)
remove_item
(
selectors
,
'KqueueSelector'
)
selectors
.
DefaultSelector
=
selectors
.
SelectSelector
def
patch_subprocess
():
def
patch_subprocess
():
patch_module
(
'subprocess'
)
patch_module
(
'subprocess'
)
...
...
greentest/3.4/test_selectors.py
0 → 100644
View file @
88663a4a
This diff is collapsed.
Click to expand it.
greentest/3.4/version
0 → 100644
View file @
88663a4a
3.4.3
greentest/test___monkey_patching.py
View file @
88663a4a
...
@@ -21,7 +21,8 @@ def get_absolute_pythonpath():
...
@@ -21,7 +21,8 @@ def get_absolute_pythonpath():
def
TESTRUNNER
(
tests
=
None
):
def
TESTRUNNER
(
tests
=
None
):
if
not
os
.
path
.
exists
(
directory
):
if
not
os
.
path
.
exists
(
directory
):
return
return
preferred_version
=
open
(
os
.
path
.
join
(
directory
,
'version'
)).
read
().
strip
()
with
open
(
os
.
path
.
join
(
directory
,
'version'
))
as
f
:
preferred_version
=
f
.
read
().
strip
()
if
preferred_version
!=
version
:
if
preferred_version
!=
version
:
util
.
log
(
'WARNING: The tests in %s/ are from version %s and your Python is %s'
,
directory
,
preferred_version
,
version
)
util
.
log
(
'WARNING: The tests in %s/ are from version %s and your Python is %s'
,
directory
,
preferred_version
,
version
)
...
...
greentest/testrunner.py
View file @
88663a4a
...
@@ -24,7 +24,7 @@ RUN_ALONE = [
...
@@ -24,7 +24,7 @@ RUN_ALONE = [
]
]
def
run_many
(
tests
,
expected
=
None
,
failfast
=
False
):
def
run_many
(
tests
,
expected
=
()
,
failfast
=
False
):
global
NWORKERS
global
NWORKERS
start
=
time
.
time
()
start
=
time
.
time
()
total
=
0
total
=
0
...
...
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