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
3eb826c6
Commit
3eb826c6
authored
Sep 11, 2017
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a warning for monkey-patching SSL when it is likely to be too late. Fixes #1016.
parent
b810756b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
src/gevent/monkey.py
src/gevent/monkey.py
+10
-5
No files found.
src/gevent/monkey.py
View file @
3eb826c6
...
@@ -356,10 +356,10 @@ def patch_thread(threading=True, _threading_local=True, Event=False, logging=Tru
...
@@ -356,10 +356,10 @@ def patch_thread(threading=True, _threading_local=True, Event=False, logging=Tru
threading_mod
=
None
threading_mod
=
None
orig_current_thread
=
None
orig_current_thread
=
None
patch_module
(
'thread'
)
patch_module
(
'thread'
,
_warnings
=
_warnings
)
if
threading
:
if
threading
:
patch_module
(
'threading'
)
patch_module
(
'threading'
,
_warnings
=
_warnings
)
if
Event
:
if
Event
:
from
gevent.event
import
Event
from
gevent.event
import
Event
...
@@ -476,12 +476,17 @@ def patch_dns():
...
@@ -476,12 +476,17 @@ def patch_dns():
patch_module
(
'socket'
,
items
=
socket
.
__dns__
)
# pylint:disable=no-member
patch_module
(
'socket'
,
items
=
socket
.
__dns__
)
# pylint:disable=no-member
def
patch_ssl
():
def
patch_ssl
(
_warnings
=
None
):
"""Replace SSLSocket object and socket wrapping functions in :mod:`ssl` with cooperative versions.
"""Replace SSLSocket object and socket wrapping functions in :mod:`ssl` with cooperative versions.
This is only useful if :func:`patch_socket` has been called.
This is only useful if :func:`patch_socket` has been called.
"""
"""
patch_module
(
'ssl'
)
if
'ssl'
in
sys
.
modules
and
hasattr
(
sys
.
modules
[
'ssl'
],
'SSLContext'
):
_queue_warning
(
'Monkey-patching ssl after ssl has already been imported '
'may lead to errors, including RecursionError on Python 3.6. '
'Please monkey-patch earlier.'
,
_warnings
)
patch_module
(
'ssl'
,
_warnings
=
_warnings
)
def
patch_select
(
aggressive
=
True
):
def
patch_select
(
aggressive
=
True
):
...
@@ -639,7 +644,7 @@ def patch_all(socket=True, dns=True, time=True, select=True, thread=True, os=Tru
...
@@ -639,7 +644,7 @@ def patch_all(socket=True, dns=True, time=True, select=True, thread=True, os=Tru
if
select
:
if
select
:
patch_select
(
aggressive
=
aggressive
)
patch_select
(
aggressive
=
aggressive
)
if
ssl
:
if
ssl
:
patch_ssl
()
patch_ssl
(
_warnings
=
_warnings
)
if
httplib
:
if
httplib
:
raise
ValueError
(
'gevent.httplib is no longer provided, httplib must be False'
)
raise
ValueError
(
'gevent.httplib is no longer provided, httplib must be False'
)
if
subprocess
:
if
subprocess
:
...
...
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