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
f6bb6009
Commit
f6bb6009
authored
Mar 29, 2018
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Defer importing gevent.monkey at startup. Fixes #1152
parent
840692b0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
7 deletions
+13
-7
src/gevent/__init__.py
src/gevent/__init__.py
+4
-1
src/gevent/_hub_local.py
src/gevent/_hub_local.py
+4
-2
src/gevent/greenlet.py
src/gevent/greenlet.py
+2
-2
src/gevent/hub.py
src/gevent/hub.py
+3
-2
No files found.
src/gevent/__init__.py
View file @
f6bb6009
...
...
@@ -83,7 +83,10 @@ except AttributeError:
_switchinterval
=
interval
from
gevent._config
import
config
from
gevent.hub
import
get_hub
,
iwait
,
wait
from
gevent._hub_local
import
get_hub
from
gevent._hub_primitives
import
iwait_on_objects
as
iwait
from
gevent._hub_primitives
import
wait_on_objects
as
wait
from
gevent.greenlet
import
Greenlet
,
joinall
,
killall
joinall
=
joinall
# export for pylint
spawn
=
Greenlet
.
spawn
...
...
src/gevent/_hub_local.py
View file @
f6bb6009
...
...
@@ -8,7 +8,7 @@ from __future__ import absolute_import
from
__future__
import
division
from
__future__
import
print_function
from
gevent.monkey
import
get_original
from
gevent._compat
import
thread_mod_name
__all__
=
[
...
...
@@ -19,7 +19,9 @@ __all__ = [
# These must be the "real" native thread versions,
# not monkey-patched.
class
_Threadlocal
(
get_original
(
thread_mod_name
,
'_local'
)):
# We are imported early enough (by gevent/__init__) that
# we can rely on not being monkey-patched in any way yet.
class
_Threadlocal
(
__import__
(
thread_mod_name
).
_local
):
def
__init__
(
self
):
# Use a class with an initializer so that we can test
...
...
src/gevent/greenlet.py
View file @
f6bb6009
...
...
@@ -19,8 +19,8 @@ from gevent._tblib import load_traceback
from
gevent.exceptions
import
InvalidSwitchError
from
gevent.
hub
import
iwait
from
gevent.
hub
import
wait
from
gevent.
_hub_primitives
import
iwait_on_objects
as
iwait
from
gevent.
_hub_primitives
import
wait_on_objects
as
wait
from
gevent.timeout
import
Timeout
...
...
src/gevent/hub.py
View file @
f6bb6009
...
...
@@ -53,13 +53,14 @@ from gevent import _hub_primitives
wait
=
_hub_primitives
.
wait_on_objects
iwait
=
_hub_primitives
.
iwait_on_objects
from
gevent.monkey
import
get_original
from
gevent.exceptions
import
LoopExit
from
gevent._waiter
import
Waiter
get_thread_ident
=
get_original
(
thread_mod_name
,
'get_ident'
)
# Need the real get_ident. We're imported early enough (by gevent/__init__.py)
# that we can be sure nothing is monkey patched yet.
get_thread_ident
=
__import__
(
thread_mod_name
).
get_ident
MAIN_THREAD_IDENT
=
get_thread_ident
()
# XXX: Assuming import is done on the main thread.
...
...
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