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
13d860ae
Commit
13d860ae
authored
Sep 20, 2017
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial fixes to enable basic tests to run on Python 3.7a1.
parent
10143732
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
4 deletions
+22
-4
src/gevent/monkey.py
src/gevent/monkey.py
+9
-0
src/greentest/greentest.py
src/greentest/greentest.py
+2
-0
src/greentest/patched_tests_setup.py
src/greentest/patched_tests_setup.py
+6
-2
src/greentest/test_threading_2.py
src/greentest/test_threading_2.py
+5
-2
No files found.
src/gevent/monkey.py
View file @
13d860ae
...
...
@@ -506,6 +506,7 @@ def patch_select(aggressive=True):
- :class:`selectors.KqueueSelector`
- :class:`selectors.DevpollSelector` (Python 3.5+)
"""
patch_module
(
'select'
)
if
aggressive
:
select
=
__import__
(
'select'
)
...
...
@@ -536,6 +537,14 @@ def patch_select(aggressive=True):
selectors
.
SelectSelector
.
_select
=
_select
_select
.
_gevent_monkey
=
True
# Python 3.7 refactors the poll-like selectors to use a common
# base class and capture a reference to select.poll, etc, at
# import time. selectors tends to get imported early
# (importing 'platform' does it: platform -> subprocess -> selectors),
# so we need to clean that up.
if
hasattr
(
selectors
,
'PollSelector'
)
and
hasattr
(
selectors
.
PollSelector
,
'_selector_cls'
):
selectors
.
PollSelector
.
_selector_cls
=
select
.
poll
if
aggressive
:
# If `selectors` had already been imported before we removed
# select.epoll|kqueue|devpoll, these may have been defined in terms
...
...
src/greentest/greentest.py
View file @
13d860ae
...
...
@@ -769,6 +769,8 @@ def default_get_number_open_files():
lsof_get_open_files = default_get_open_files
try:
# psutil import subprocess which on Python 3 imports selectors.
# This can expose issues with monkey-patching.
import psutil
except ImportError:
get_open_files = default_get_open_files
...
...
src/greentest/patched_tests_setup.py
View file @
13d860ae
...
...
@@ -6,11 +6,15 @@ import contextlib
import
functools
import
sys
import
os
import
platform
# At least on 3.6+, importing platform
# imports subprocess, which imports selectors. That
# can expose issues with monkey patching. We don't need it
# though.
# import platform
import
re
TRAVIS
=
os
.
environ
.
get
(
"TRAVIS"
)
==
"true"
OSX
=
bool
(
platform
.
mac_ver
()[
0
])
OSX
=
sys
.
platform
==
'darwin'
# By default, test cases are expected to switch and emit warnings if there was none
# If a test is found in this list, it's expected not to switch.
...
...
src/greentest/test_threading_2.py
View file @
13d860ae
...
...
@@ -470,7 +470,6 @@ class ThreadJoinOnShutdown(unittest.TestCase):
"""
self
.
_run_and_join
(
script
)
@
greentest
.
skipOnPyPy3
(
"Buffering issue."
)
def
test_3_join_in_forked_from_thread
(
self
):
# Like the test above, but fork() was called from a worker thread
# In the forked process, the main Thread object must be marked as stopped.
...
...
@@ -500,13 +499,17 @@ class ThreadJoinOnShutdown(unittest.TestCase):
w = threading.Thread(target=worker)
w.start()
import sys
if sys.version_info[:2] >= (3, 7) or (sys.version_info[:2] >= (3, 5) and hasattr(sys, 'pypy_version_info')):
w.join()
"""
# In PyPy3 5.8.0, if we don't wait on this top-level "thread", 'w',
# we never see "end of thread". It's not clear why, since that's being
# done in a child of this process. Yet in normal CPython 3, waiting on this
# causes the whole process to lock up (possibly because of some loop within
# the interpreter waiting on thread locks, like the issue described in threading.py
# for Python 3.4? in any case, it doesn't hang in Python 2.)
# for Python 3.4? in any case, it doesn't hang in Python 2.) This changed in
# 3.7a1 and waiting on it is again necessary and doesn't hang.
self
.
_run_and_join
(
script
)
...
...
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