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
eaa13681
Commit
eaa13681
authored
Jul 09, 2009
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
monkey: patch ssl module when on 2.6 (very limited support)
parent
5c752d98
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
gevent/monkey.py
gevent/monkey.py
+11
-6
No files found.
gevent/monkey.py
View file @
eaa13681
import
sys
def
patch_os
():
from
gevent
import
fork
import
os
...
...
@@ -28,13 +30,19 @@ def patch_socket():
_socket
.
socketpair
=
socketpair
# also gethostbyname, getaddrinfo
def
patch_ssl
():
if
sys
.
version_info
[:
2
]
>=
(
2
,
6
):
from
gevent.socket
import
wrap_ssl
import
ssl
ssl
.
wrap_socket
=
wrap_ssl
def
patch_select
():
from
gevent.select
import
select
_select
=
__import__
(
'select'
)
globals
()[
'_select_select'
]
=
_select
.
select
_select
.
select
=
select
def
patch_all
(
socket
=
True
,
time
=
True
,
select
=
True
,
thread
=
True
,
os
=
True
):
def
patch_all
(
socket
=
True
,
time
=
True
,
select
=
True
,
thread
=
True
,
os
=
True
,
ssl
=
True
):
# order is important
if
os
:
patch_os
()
...
...
@@ -46,13 +54,10 @@ def patch_all(socket=True, time=True, select=True, thread=True, os=True):
patch_socket
()
if
select
:
patch_select
()
# XXX patch unittest to count switches and detect event_count and run the standard tests 2 hour
# make makefile() return GreenFile. since it uses socket's buffer, while _fileobject creates a new one 2 hour
# probably make GreenSocket be also a file and makefile() just increases refcount and returns self
if
ssl
:
patch_ssl
()
if
__name__
==
'__main__'
:
import
sys
modules
=
[
x
.
replace
(
'patch_'
,
''
)
for
x
in
globals
().
keys
()
if
x
.
startswith
(
'patch_'
)
and
x
!=
'patch_all'
]
script_help
=
"""gevent.monkey - monkey patch the standard modules to use gevent.
...
...
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