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
00b173cc
Commit
00b173cc
authored
Jul 21, 2016
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
backport fix for #805.
parent
08080428
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
7 deletions
+46
-7
changelog.rst
changelog.rst
+2
-0
gevent/__init__.py
gevent/__init__.py
+4
-3
gevent/monkey.py
gevent/monkey.py
+4
-4
greentest/greentest.py
greentest/greentest.py
+12
-0
greentest/test__signal.py
greentest/test__signal.py
+24
-0
No files found.
changelog.rst
View file @
00b173cc
...
...
@@ -13,6 +13,8 @@
- :class:`selectors.SelectSelector` is properly monkey-patched
regardless of the order of imports. Reported in :issue:`835` by
Przemysław Węgrzyn.
- Python 2: ``reload(site)`` no longer fails with a ``TypeError`` if
gevent has been imported. Reported in :issue:`805` by Jake Hilton.
1.1.1 (Apr 4, 2016)
===================
...
...
gevent/__init__.py
View file @
00b173cc
...
...
@@ -82,9 +82,10 @@ class _signal_metaclass(type):
return
getattr
(
_signal_module
,
name
)
def
__setattr__
(
self
,
name
,
value
):
# Because we can't know whether to try to go to the module
# or the class, we don't allow setting an attribute after the fact
raise
TypeError
(
"Cannot set attribute"
)
# For symmetry with getattr and dir, pass all
# attribute setting on to the module. (This makes
# reloading work, see issue #805)
setattr
(
_signal_module
,
name
,
value
)
def
__instancecheck__
(
self
,
instance
):
return
isinstance
(
instance
,
_signal_class
)
...
...
gevent/monkey.py
View file @
00b173cc
...
...
@@ -476,10 +476,10 @@ def patch_select(aggressive=True):
assert
select
.
select
is
not
orig_select_select
selectors
=
__import__
(
'selectors'
)
if
selectors
.
SelectSelector
.
_select
in
(
select
.
select
,
orig_select_select
):
def
_select
(
self
,
*
args
,
**
kwargs
):
# pylint:disable=unused-argument
return
select
.
select
(
*
args
,
**
kwargs
)
selectors
.
SelectSelector
.
_select
=
_select
_select
.
_gevent_monkey
=
True
def
_select
(
self
,
*
args
,
**
kwargs
):
# pylint:disable=unused-argument
return
select
.
select
(
*
args
,
**
kwargs
)
selectors
.
SelectSelector
.
_select
=
_select
_select
.
_gevent_monkey
=
True
if
aggressive
:
# If `selectors` had already been imported before we removed
...
...
greentest/greentest.py
View file @
00b173cc
...
...
@@ -71,12 +71,19 @@ PLATFORM_SPECIFIC_SUFFIXES = ['2', '279', '3']
if
sys
.
platform
.
startswith
(
'win'
):
PLATFORM_SPECIFIC_SUFFIXES
.
append
(
'posix'
)
PY2
=
None
PY3
=
None
PY34
=
None
NON_APPLICABLE_SUFFIXES
=
[]
if
sys
.
version_info
[
0
]
==
3
:
# Python 3
NON_APPLICABLE_SUFFIXES
.
extend
((
'2'
,
'279'
))
PY2
=
False
PY3
=
True
if
sys
.
version_info
[
1
]
>=
4
:
PY34
=
True
if
sys
.
version_info
[
0
]
==
2
:
# Any python 2
PY3
=
False
...
...
@@ -157,6 +164,11 @@ def wrap_timeout(timeout, method):
return
wrapped
def
ignores_leakcheck
(
func
):
func
.
ignore_leakcheck
=
True
return
func
def
wrap_refcount
(
method
):
if
not
RUN_LEAKCHECKS
:
return
method
...
...
greentest/test__signal.py
View file @
00b173cc
...
...
@@ -41,6 +41,30 @@ if hasattr(signal, 'SIGALRM'):
finally
:
sig
.
cancel
()
@
greentest
.
ignores_leakcheck
def
test_reload
(
self
):
# The site module tries to set attributes
# on all the modules that are loaded (specifically, __file__).
# If gevent.signal is loaded, and is our compatibility shim,
# this used to fail on Python 2: sys.modules['gevent.signal'] has no
# __loader__ attribute, so site.py's main() function tries to do
# gevent.signal.__file__ = os.path.abspath(gevent.signal.__file__), which
# used to not be allowed. (Under Python 3, __loader__ is present so this
# doesn't happen). See
# https://github.com/gevent/gevent/issues/805
import
gevent.signal
# make sure it's in sys.modules pylint:disable=redefined-outer-name
assert
gevent
.
signal
import
site
if
greentest
.
PY34
:
from
importlib
import
reload
as
reload_module
elif
greentest
.
PY3
:
from
imp
import
reload
as
reload_module
else
:
# builtin on py2
reload_module
=
reload
# pylint:disable=undefined-variable
reload_module
(
site
)
if
__name__
==
'__main__'
:
greentest
.
main
()
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